calendar-social/ansible/roles/nginx/templates/site-ssl.conf.j2

42 lines
971 B
Django/Jinja

upstream appserver {
server localhost:8000 fail_timeout=0;
}
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl deferred;
server_name {{ host_name }};
ssl_certificate {{ home_path }}/{{ project_name }}.crt;
ssl_certificate_key {{ home_path }}/{{ project_name }}.key;
ssl_session_cache shared:SSL:32m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/{{ project_name }}.access.log;
error_log /var/log/nginx/{{ project_name }}.error.log info;
keepalive_timeout 5;
location /static {
alias {{ project_path }}/static;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_read_timeout 180s;
if (!-f $request_filename) {
proxy_pass http://appserver;
break;
}
}
}