forked from ISTI-ansible-roles/ansible-roles
library/roles/smartgears/smartgears-nginx-frontend/templates/generic-smartgears-virtualhost.j2: new virtualhost that supports https with or without redirection from http.
This commit is contained in:
parent
b32959ce2c
commit
61a0f90bb4
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
setup_nginx: False
|
||||
http_redirect_to_https: False
|
||||
letsencrypt_acme_install: False
|
||||
smartgears_install_generic_virthost: True
|
||||
|
|
@ -2,19 +2,23 @@ server {
|
|||
listen {{ http_port }};
|
||||
server_name {{ item.servername }};
|
||||
{% if letsencrypt_acme_install %}
|
||||
location ^~ /.well-known/acme-challenge {
|
||||
proxy_pass http://127.0.0.1:{{ letsencrypt_acme_standalone_port }}/.well-known/acme-challenge;
|
||||
access_log /var/log/nginx/letsencrypt_access.log;
|
||||
error_log /var/log/nginx/letsencrypt_error.log;
|
||||
}
|
||||
include /etc/nginx/snippets/letsencrypt-proxy.conf;
|
||||
{% endif %}
|
||||
{% if not letsencrypt_acme_install %}
|
||||
{% if not http_redirect_to_https %}
|
||||
access_log /var/log/nginx/{{ item.servername }}_access.log;
|
||||
error_log /var/log/nginx/{{ item.servername }}_error.log;
|
||||
root /usr/share/nginx/html/;
|
||||
|
||||
client_max_body_size 100M;
|
||||
|
||||
{% if haproxy_ips is defined %}
|
||||
# We are behind haproxy
|
||||
{% for ip in haproxy_ips %}
|
||||
set_real_ip_from {{ ip }};
|
||||
{% endfor %}
|
||||
real_ip_header X-Forwarded-For;
|
||||
{% endif %}
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
@ -37,20 +41,7 @@ server {
|
|||
server_tokens off;
|
||||
|
||||
# Proxy stuff
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_buffer_size {{ nginx_proxy_buffer_size }};
|
||||
proxy_buffers {{ nginx_proxy_buffers }};
|
||||
proxy_busy_buffers_size {{ nginx_proxy_busy_buffers_size }};
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_http_version 1.1;
|
||||
proxy_redirect {{ nginx_proxy_redirect }};
|
||||
proxy_buffering {{ nginx_proxy_buffering }};
|
||||
proxy_connect_timeout {{ nginx_proxy_connect_timeout }};
|
||||
proxy_read_timeout {{ nginx_proxy_read_timeout }};
|
||||
proxy_send_timeout {{ nginx_proxy_send_timeout }};
|
||||
include /etc/nginx/snippets/nginx-proxy-params.conf;
|
||||
|
||||
{% if r_connector_install %}
|
||||
location /auth-sign-in {
|
||||
|
@ -79,7 +70,9 @@ server {
|
|||
return 301 https://{{ item.servername }}$request_uri;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
}
|
||||
|
||||
{% if letsencrypt_acme_install %}
|
||||
server {
|
||||
listen {{ https_port }} ssl;
|
||||
|
@ -93,16 +86,8 @@ server {
|
|||
|
||||
client_max_body_size 100M;
|
||||
|
||||
ssl_certificate {{ letsencrypt_acme_certs_dir }}/fullchain;
|
||||
ssl_certificate_key {{ letsencrypt_acme_certs_dir }}/privkey;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA";
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
add_header Strict-Transport-Security max-age=15768000;
|
||||
include /etc/nginx/snippets/nginx-server-ssl.conf;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
@ -125,21 +110,7 @@ server {
|
|||
server_tokens off;
|
||||
|
||||
# Proxy stuff
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_buffer_size {{ nginx_proxy_buffer_size }};
|
||||
proxy_buffers {{ nginx_proxy_buffers }};
|
||||
proxy_busy_buffers_size {{ nginx_proxy_busy_buffers_size }};
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_http_version 1.1;
|
||||
proxy_redirect {{ nginx_proxy_redirect }};
|
||||
proxy_buffering {{ nginx_proxy_buffering }};
|
||||
proxy_connect_timeout {{ nginx_proxy_connect_timeout }};
|
||||
proxy_read_timeout {{ nginx_proxy_read_timeout }};
|
||||
proxy_send_timeout {{ nginx_proxy_send_timeout }};
|
||||
|
||||
include /etc/nginx/snippets/nginx-proxy-params.conf;
|
||||
{% if r_connector_install %}
|
||||
location /auth-sign-in {
|
||||
rewrite ^/auth-sign-in http://{{ item.servername }}/r-connector/gcube/service/disconnect;
|
||||
|
@ -162,5 +133,6 @@ server {
|
|||
proxy_pass http://localhost:8787/;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue