diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index 795751153..5c2dee6ed 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -5,28 +5,23 @@ with_items: - { src: "server.conf",dest: "/etc/nginx/" } - { src: "nginx.conf",dest: "/etc/nginx/" } - - { src: "usb-lib.conf",dest: "/etc/nginx/conf.d/" } - - { src: "modules.conf",dest: "/etc/nginx/conf.d/" } -# - { src: "admin-console.ini",dest: "/etc/uwsgi/apps-enabled/" } -# the above should be enough once uwsgi is started -# - { src: "uwsgi.unit",dest: "/etc/systemd/system/uwsgi.socket" } - - { src: 'ports.conf' , dest: '/etc/{{ apache_service }}/' , mode: '0644' } + - { src: "ports.conf" , dest: "/etc/{{ apache_service }}/" } + - { src: "iiab.conf.j2",dest: "/etc/nginx/conf.d/iiab.conf" } when: nginx_enabled +- name: Clean stale config files + file: + state: absent + path: '{{ item.path }}' + with_items: + - { path: "/etc/nginx/conf.d/usb-lib.conf" } + - { path: "/etc/nginx/conf.d/modules.conf" } + - name: Insure that apache2 is not running -- we may need port swap systemd: name: apache2 state: stopped -# optional services -- name: Install config for Admin Console - template: - src: admin-console-nginx.conf -# Comment one or the other to revert from nginx back to apache2, if required -# src: admin-console-apache.conf - dest: /etc/nginx/conf.d/admin-console.conf - when: admin_console_enabled and nginx_enabled - # the below slides in nginx's proxypass config files for apache on localhost # via the ports.conf file installed above - name: Install proxpass to apache running on localhost port {{ apache_port }} @@ -73,10 +68,3 @@ state: restarted enabled: true when: nginx_enabled - -#- name: Enable the uwsgi systemd service -# systemd: -# name: uwsgi -# state: restarted -# enabled: true -# when: admin_console_enabled and nginx_enabled diff --git a/roles/nginx/templates/modules.conf b/roles/nginx/templates/iiab.conf.j2 similarity index 52% rename from roles/nginx/templates/modules.conf rename to roles/nginx/templates/iiab.conf.j2 index 16d3cb641..568a4dcc4 100644 --- a/roles/nginx/templates/modules.conf +++ b/roles/nginx/templates/iiab.conf.j2 @@ -1,10 +1,18 @@ +location / { + rewrite ^/$ $1/{{ iiab_home_url }}; +} + +location /usb { + alias /library/www/html/local_content/; + autoindex on; +} + +location /local_content/ { + autoindex on; +} location /modules/ { fancyindex on; # Enable fancy indexes. fancyindex_exact_size off; # Output human-readable file sizes. fancyindex_ignore index.htmlf rachel-index.php; -# autoindex on; -# autoindex_exact_size off; -# autoindex_format html; -# autoindex_localtime on; } diff --git a/roles/nginx/templates/server.conf b/roles/nginx/templates/server.conf index 0af7b08f6..e734bde1f 100644 --- a/roles/nginx/templates/server.conf +++ b/roles/nginx/templates/server.conf @@ -8,7 +8,6 @@ server { access_log {{ apache_log_dir }}/scripts.log scripts; index index.php index.html index.htm; - rewrite ^/$ $scheme://$server_addr/home/; # let individual services drop location blocks in conf.d include /etc/nginx/conf.d/*; diff --git a/roles/nginx/templates/usb-lib.conf b/roles/nginx/templates/usb-lib.conf deleted file mode 100644 index 8feb6703d..000000000 --- a/roles/nginx/templates/usb-lib.conf +++ /dev/null @@ -1,7 +0,0 @@ -location /usb { - alias /library/www/html/local_content/; - autoindex on; -} -location /local_content/ { - autoindex on; -}