mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #2086 from tim-moody/nginx-conf2
Native nginx services [MediaWiki, WordPress, OSM, AWStats]
This commit is contained in:
commit
73618267ba
10 changed files with 142 additions and 21 deletions
|
@ -1,5 +1,5 @@
|
||||||
location ~ ^/awstats {
|
location ~ ^/awstats {
|
||||||
rewrite ^ http://box.lan/cgi-bin/awstats.pl?config=schoolserver;
|
rewrite ^ /cgi-bin/awstats.pl;
|
||||||
}
|
}
|
||||||
location ^~ /awstatsicons {
|
location ^~ /awstatsicons {
|
||||||
alias /usr/share/awstats/icon/;
|
alias /usr/share/awstats/icon/;
|
||||||
|
|
|
@ -25,5 +25,5 @@ mediawiki_site_name: Community Wiki
|
||||||
mediawiki_install_path: "{{ content_base }}" # /library
|
mediawiki_install_path: "{{ content_base }}" # /library
|
||||||
mediawiki_abs_path: "{{ mediawiki_install_path }}/mediawiki-{{ mediawiki_version }}"
|
mediawiki_abs_path: "{{ mediawiki_install_path }}/mediawiki-{{ mediawiki_version }}"
|
||||||
|
|
||||||
mediawiki_url: /mediawiki
|
mediawiki_url: /wiki
|
||||||
mediawiki_full_url: "http://{{ iiab_hostname }}.{{ iiab_domain }}{{ mediawiki_url }}" # http://box.lan/mediawiki
|
mediawiki_full_url: "http://{{ iiab_hostname }}.{{ iiab_domain }}{{ mediawiki_url }}" # http://box.lan/wiki
|
||||||
|
|
|
@ -17,6 +17,24 @@
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
- name: Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template, for http://box{{ mediawiki_url }}
|
||||||
|
template:
|
||||||
|
src: mediawiki-nginx.conf.j2
|
||||||
|
dest: "{{ nginx_config_dir }}/mediawiki-nginx.conf"
|
||||||
|
when: mediawiki_enabled
|
||||||
|
|
||||||
|
- name: Remove mediawiki-nginx.conf if not mediawiki_enabled (debuntu)
|
||||||
|
file:
|
||||||
|
path: "{{ nginx_config_dir }}/mediawiki-nginx.conf"
|
||||||
|
state: absent
|
||||||
|
when: not mediawiki_enabled and is_debuntu
|
||||||
|
|
||||||
|
- name: Restart nginx service to enable/disable http://box{{ mediawiki_url }}
|
||||||
|
systemd:
|
||||||
|
name: nginx
|
||||||
|
daemon_reload: yes
|
||||||
|
state: restarted
|
||||||
|
|
||||||
- name: Add 'mediawiki' variable values to {{ iiab_ini_file }}
|
- name: Add 'mediawiki' variable values to {{ iiab_ini_file }}
|
||||||
ini_file:
|
ini_file:
|
||||||
path: "{{ iiab_ini_file }}"
|
path: "{{ iiab_ini_file }}"
|
||||||
|
|
|
@ -25,6 +25,12 @@
|
||||||
mode: 0755
|
mode: 0755
|
||||||
keep_newer: yes
|
keep_newer: yes
|
||||||
|
|
||||||
|
- name: Create symlink mwlink from docroot to {{ mediawiki_abs_path }}
|
||||||
|
file:
|
||||||
|
src: "{{ mediawiki_abs_path }}"
|
||||||
|
dest: "{{ doc_root }}/mwlink"
|
||||||
|
state: link
|
||||||
|
|
||||||
- name: Start MySQL service, so we can create db
|
- name: Start MySQL service, so we can create db
|
||||||
service:
|
service:
|
||||||
state: started
|
state: started
|
||||||
|
@ -51,7 +57,7 @@
|
||||||
--installdbpass={{ mediawiki_db_user_password }}
|
--installdbpass={{ mediawiki_db_user_password }}
|
||||||
--dbuser={{ mediawiki_db_user }}
|
--dbuser={{ mediawiki_db_user }}
|
||||||
--dbpass={{ mediawiki_db_user_password }}
|
--dbpass={{ mediawiki_db_user_password }}
|
||||||
--scriptpath=/mediawiki
|
--scriptpath=/mwlink
|
||||||
--lang=en
|
--lang=en
|
||||||
--pass={{ mediawiki_admin_user_password }}
|
--pass={{ mediawiki_admin_user_password }}
|
||||||
"{{ mediawiki_site_name }}"
|
"{{ mediawiki_site_name }}"
|
||||||
|
@ -60,11 +66,25 @@
|
||||||
chdir: "{{ mediawiki_abs_path }}"
|
chdir: "{{ mediawiki_abs_path }}"
|
||||||
creates: "{{ mediawiki_abs_path }}/LocalSettings.php"
|
creates: "{{ mediawiki_abs_path }}/LocalSettings.php"
|
||||||
|
|
||||||
|
- name: Configure wgArticlePath variable in {{ mediawiki_abs_path }}/LocalSettings.php
|
||||||
|
lineinfile:
|
||||||
|
dest: "{{ mediawiki_abs_path }}/LocalSettings.php"
|
||||||
|
line: '$wgArticlePath = "/wiki/$1";'
|
||||||
|
create: yes
|
||||||
|
|
||||||
|
- name: Configure wgUsePathInfo variable in {{ mediawiki_abs_path }}/LocalSettings.php
|
||||||
|
lineinfile:
|
||||||
|
dest: "{{ mediawiki_abs_path }}/LocalSettings.php"
|
||||||
|
line: '$wgUsePathInfo = true;'
|
||||||
|
create: yes
|
||||||
|
|
||||||
- name: Install /etc/{{ apache_config_dir }}/mediawiki.conf from template, for http://box{{ mediawiki_url }}
|
- name: Install /etc/{{ apache_config_dir }}/mediawiki.conf from template, for http://box{{ mediawiki_url }}
|
||||||
template:
|
template:
|
||||||
src: mediawiki.conf.j2
|
src: mediawiki.conf.j2
|
||||||
dest: "/etc/{{ apache_config_dir }}/mediawiki.conf"
|
dest: "/etc/{{ apache_config_dir }}/mediawiki.conf"
|
||||||
|
|
||||||
|
# Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template in enable.yml
|
||||||
|
|
||||||
- name: Add 'mediawiki_installed' variable values to {{ iiab_state_file }}
|
- name: Add 'mediawiki_installed' variable values to {{ iiab_state_file }}
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "{{ iiab_state_file }}"
|
dest: "{{ iiab_state_file }}"
|
||||||
|
|
54
roles/mediawiki/templates/mediawiki-nginx.conf.j2
Normal file
54
roles/mediawiki/templates/mediawiki-nginx.conf.j2
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
# this works if (docroot)/mwlink links to install
|
||||||
|
# and LocalSettings.php has
|
||||||
|
# $wgScriptPath = "/mwlink";
|
||||||
|
# $wgArticlePath = "/wiki/$1";
|
||||||
|
# $wgUsePathInfo = true;
|
||||||
|
|
||||||
|
location ~ ^/mwlink/(index|load|api|thumb|opensearch_desc)\.php$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_pass php; # or whatever port your PHP-FPM listens on
|
||||||
|
}
|
||||||
|
|
||||||
|
# Images
|
||||||
|
location /mwlink/images {
|
||||||
|
# Separate location for images/ so .php execution won't apply
|
||||||
|
}
|
||||||
|
location /mwlink/images/deleted {
|
||||||
|
# Deny access to deleted images folder
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
# MediaWiki assets (usually images)
|
||||||
|
location ~ ^/mwlink/resources/(assets|lib|src) {
|
||||||
|
try_files $uri 404;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
expires 7d;
|
||||||
|
}
|
||||||
|
# Assets, scripts and styles from skins and extensions
|
||||||
|
location ~ ^/mwlink/(skins|extensions)/.+\.(css|js|gif|jpg|jpeg|png|svg)$ {
|
||||||
|
try_files $uri 404;
|
||||||
|
add_header Cache-Control "public";
|
||||||
|
expires 7d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## Uncomment the following code if you wish to use the installer/updater
|
||||||
|
## installer/updater
|
||||||
|
#location /mwlink/mw-config/ {
|
||||||
|
# # Do this inside of a location so it can be negated
|
||||||
|
# location ~ \.php$ {
|
||||||
|
# include /etc/nginx/fastcgi_params;
|
||||||
|
# fastcgi_param SCRIPT_FILENAME $document_root/mwlink/mw-config/$fastcgi_script_name;
|
||||||
|
# fastcgi_pass 127.0.0.1:9000; # or whatever port your PHP-FPM listens on
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Handling for the article path (pretty URLs)
|
||||||
|
location {{ mediawiki_url }}/ {
|
||||||
|
rewrite ^{{ mediawiki_url }}/(?<pagename>.*)$ /mwlink/index.php;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Explicit access to the root website, redirect to main page (adapt as needed)
|
||||||
|
location = {{ mediawiki_url }} {
|
||||||
|
return 301 {{ mediawiki_url }}/Main_Page;
|
||||||
|
}
|
|
@ -25,14 +25,24 @@
|
||||||
dest: "/etc/nginx/conf.d/lokole-nginx.conf"
|
dest: "/etc/nginx/conf.d/lokole-nginx.conf"
|
||||||
when: lokole_enabled
|
when: lokole_enabled
|
||||||
|
|
||||||
- name: Install MediaWiki's nginx conf.d file from template
|
# mediawiki and wordpress are no longer proxied
|
||||||
template:
|
|
||||||
src: mediawiki-nginx.conf.j2
|
|
||||||
dest: /etc/nginx/conf.d/mediawiki-nginx.conf
|
|
||||||
when: mediawiki_enabled
|
|
||||||
|
|
||||||
- name: Install WordPress's nginx conf.d file from template
|
#- name: Install MediaWiki's nginx conf.d file from template
|
||||||
template: src=nextcloud-nginx.conf dest=/etc/nginx/conf.d/nextcloud-nginx.conf
|
# template:
|
||||||
|
# src: mediawiki-nginx.conf.j2
|
||||||
|
# dest: /etc/nginx/conf.d/mediawiki-nginx.conf
|
||||||
|
# when: mediawiki_enabled
|
||||||
|
|
||||||
|
#- name: Install WordPress's nginx conf.d file from template
|
||||||
|
# template:
|
||||||
|
# src: wordpress-nginx.conf
|
||||||
|
# dest: /etc/nginx/conf.d/
|
||||||
|
# when: wordpress_enabled
|
||||||
|
|
||||||
|
- name: Install Nextcloud's nginx conf.d file from template
|
||||||
|
template:
|
||||||
|
src: nextcloud-nginx.conf
|
||||||
|
dest: /etc/nginx/conf.d/nextcloud-nginx.conf
|
||||||
when: nextcloud_enabled
|
when: nextcloud_enabled
|
||||||
|
|
||||||
- name: Install NodeRed's nginx conf.d file from template
|
- name: Install NodeRed's nginx conf.d file from template
|
||||||
|
@ -44,11 +54,5 @@
|
||||||
mode: 0666
|
mode: 0666
|
||||||
when: nodered_enabled
|
when: nodered_enabled
|
||||||
|
|
||||||
- name: Install WordPress's nginx conf.d file from template
|
|
||||||
template:
|
|
||||||
src: wordpress-nginx.conf
|
|
||||||
dest: /etc/nginx/conf.d/
|
|
||||||
when: wordpress_enabled
|
|
||||||
|
|
||||||
#- name: Install proxpass to apache running on localhost
|
#- name: Install proxpass to apache running on localhost
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# For downloadable regional vector tilesets
|
# For downloadable regional vector tilesets
|
||||||
location /maps {
|
location /maps {
|
||||||
rewrite ^/maps/(.*)$ /osm-vector-maps/$1;
|
rewrite ^/maps(.*)$ /osm-vector-maps$1;
|
||||||
}
|
}
|
||||||
location /osm-vector-maps {
|
location /osm-vector-maps {
|
||||||
alias /library/www/osm-vector-maps;
|
alias /library/www/osm-vector-maps;
|
||||||
|
|
|
@ -101,6 +101,12 @@
|
||||||
dest: "/etc/{{ apache_config_dir }}/wordpress.conf"
|
dest: "/etc/{{ apache_config_dir }}/wordpress.conf"
|
||||||
when: apache_enabled
|
when: apache_enabled
|
||||||
|
|
||||||
|
- name: Install {{ nginx_config_dir }}/wordpress-nginx.conf from template, for http://box{{ wp_url }}
|
||||||
|
template:
|
||||||
|
src: wordpress-nginx.conf.j2
|
||||||
|
dest: "{{ nginx_config_dir }}/wordpress-nginx.conf"
|
||||||
|
when: nginx_enabled
|
||||||
|
|
||||||
- name: Add 'wordpress_installed' variable values to {{ iiab_state_file }}
|
- name: Add 'wordpress_installed' variable values to {{ iiab_state_file }}
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "{{ iiab_state_file }}"
|
dest: "{{ iiab_state_file }}"
|
||||||
|
|
19
roles/wordpress/templates/wordpress-nginx.conf.j2
Normal file
19
roles/wordpress/templates/wordpress-nginx.conf.j2
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
location {{ wp_url }} {
|
||||||
|
#rewrite_log on;
|
||||||
|
root {{ content_base }};
|
||||||
|
|
||||||
|
location ~ .*\.php$ {
|
||||||
|
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ ^({{ wp_url }})(/.*)/$ {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_pass php;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_param SCRIPT_FILENAME {{ wp_abs_path }}/index.php;
|
||||||
|
}
|
||||||
|
}
|
|
@ -240,7 +240,7 @@ nginx_port: "80"
|
||||||
nginx_interface: "0.0.0.0"
|
nginx_interface: "0.0.0.0"
|
||||||
nginx_install: True
|
nginx_install: True
|
||||||
nginx_enabled: True
|
nginx_enabled: True
|
||||||
|
nginx_config_dir: /etc/nginx/conf.d
|
||||||
|
|
||||||
# See also Apache vars {default_language, language_priority} @ top of this file
|
# See also Apache vars {default_language, language_priority} @ top of this file
|
||||||
#
|
#
|
||||||
|
@ -338,7 +338,7 @@ azuracast_port_range_prefix: 10
|
||||||
|
|
||||||
dokuwiki_install: False
|
dokuwiki_install: False
|
||||||
dokuwiki_enabled: False
|
dokuwiki_enabled: False
|
||||||
dokuwiki_url: /wiki
|
dokuwiki_url: /dokuwiki
|
||||||
|
|
||||||
mediawiki_install: False
|
mediawiki_install: False
|
||||||
mediawiki_enabled: False
|
mediawiki_enabled: False
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue