forked from ISTI-ansible-roles/ansible-roles
Fixes to the smartgears new nginx virtualhost so that we can configure virtualhosts without smartgears.
This commit is contained in:
parent
1c8bd4a269
commit
913b5a57dd
|
@ -7,15 +7,24 @@
|
|||
with_items: '{{ smartgears_nginx_virtualhosts }}'
|
||||
notify: Reload nginx
|
||||
|
||||
- name: Enable the nginx virtualhosts
|
||||
- name: Enable the smartgears nginx virtualhosts
|
||||
file: src=/etc/nginx/sites-available/{{ item.virthost_name }} dest=/etc/nginx/sites-enabled/smartgears_{{ item.smartgears_id }}.conf state=link
|
||||
with_items: '{{ smartgears_nginx_virtualhosts }}'
|
||||
when: item.smartgears_id is defined
|
||||
notify: Reload nginx
|
||||
|
||||
- name: Enable the non smartgears nginx virtualhosts
|
||||
file: src=/etc/nginx/sites-available/{{ item.virthost_name }} dest=/etc/nginx/sites-enabled/smartgears_{{ item.virthost_name }}.conf state=link
|
||||
with_items: '{{ smartgears_nginx_virtualhosts }}'
|
||||
when: item.smartgears_id is not defined
|
||||
notify: Reload nginx
|
||||
|
||||
- name: Give the smartgears user access to the document root, and create it if needed
|
||||
file: dest={{ item.root}} state=directory owner={{ item.user }} group={{ item.user }} mode=0755
|
||||
with_items: '{{ smartgears_nginx_virtualhosts }}'
|
||||
when: smartgears_nginx_rw_html_root
|
||||
when:
|
||||
- smartgears_nginx_rw_html_root
|
||||
- item.user is defined
|
||||
notify: Reload nginx
|
||||
tags: [ 'nginx', 'virtualhost', 'web_root' ]
|
||||
|
||||
|
|
|
@ -28,23 +28,24 @@ server {
|
|||
{% if item.access_log is defined %}
|
||||
access_log {{ item.access_log }};
|
||||
{% else %}
|
||||
access_log /var/log/nginx/{{ item.server_name }}_access.log;
|
||||
access_log /var/log/nginx/{{ item.virthost_name }}_access.log;
|
||||
{% endif %}
|
||||
|
||||
{% if item.error_log is defined %}
|
||||
error_log {{ item.error_log }};
|
||||
{% else %}
|
||||
error_log /var/log/nginx/{{ item.server_name }}_error.log;
|
||||
error_log /var/log/nginx/{{ item.virthost_name }}_error.log;
|
||||
{% endif %}
|
||||
|
||||
server_tokens {{ item.server_tokens | default('off') }};
|
||||
|
||||
{% if item.ssl_enabled and item.ssl_only %}
|
||||
{% if item.smartgears_over_ssl %}
|
||||
{% if item.smartgears_over_ssl is defined and item.smartgears_over_ssl %}
|
||||
location / {
|
||||
return 301 https://{{ item.server_name }}$request_uri;
|
||||
}
|
||||
{% else %}
|
||||
{% if item.smartgears_id is defined %}
|
||||
# Smartgears answers over http
|
||||
include /etc/nginx/snippets/nginx-proxy-params.conf;
|
||||
{% if r_connector_install is defined and r_connector_install %}
|
||||
|
@ -66,6 +67,7 @@ server {
|
|||
proxy_pass http://127.0.0.1:{{ item.smartgears_http_port }}/data-transfer-service;
|
||||
}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
location / {
|
||||
return 301 https://{{ item.server_name }}$request_uri;
|
||||
|
@ -147,6 +149,7 @@ server {
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if item.smartgears_id is defined %}
|
||||
# Smartgears special urls - start
|
||||
{% if r_connector_install is defined and r_connector_install %}
|
||||
location /auth-sign-in {
|
||||
|
@ -274,6 +277,7 @@ server {
|
|||
}
|
||||
{% endif %}
|
||||
# Smartgears targets - end
|
||||
{% endif %}
|
||||
|
||||
{% if item.locations is defined %}
|
||||
{% for location in item.locations -%}
|
||||
|
@ -346,13 +350,13 @@ server {
|
|||
{% if item.access_log is defined %}
|
||||
access_log {{ item.access_log }};
|
||||
{% else %}
|
||||
access_log /var/log/nginx/{{ item.server_name }}_ssl_access.log;
|
||||
access_log /var/log/nginx/{{ item.virthost_name }}_ssl_access.log;
|
||||
{% endif %}
|
||||
|
||||
{% if item.error_log is defined %}
|
||||
error_log {{ item.error_log }};
|
||||
{% else %}
|
||||
error_log /var/log/nginx/{{ item.server_name }}_ssl_error.log;
|
||||
error_log /var/log/nginx/{{ item.virthost_name }}_ssl_error.log;
|
||||
{% endif %}
|
||||
|
||||
root {{ item.root | default('/usr/share/nginx/html/') }};
|
||||
|
@ -370,8 +374,11 @@ server {
|
|||
log_not_found off;
|
||||
access_log off;
|
||||
}
|
||||
location ~ /\. {
|
||||
location ~ /\.(?!well-known).* {
|
||||
deny all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
return 404;
|
||||
}
|
||||
|
||||
{% if haproxy_ips is defined %}
|
||||
|
@ -431,6 +438,7 @@ server {
|
|||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if item.smartgears_id is defined %}
|
||||
# Smartgears special urls - start
|
||||
{% if r_connector_install is defined and r_connector_install %}
|
||||
location /auth-sign-in {
|
||||
|
@ -558,6 +566,7 @@ server {
|
|||
}
|
||||
{% endif %}
|
||||
# Smartgears targets - end
|
||||
{% endif %}
|
||||
|
||||
{% if item.locations is defined %}
|
||||
{% for location in item.locations -%}
|
||||
|
|
Loading…
Reference in New Issue