2017-08-09 23:07:49 +02:00
|
|
|
upstream gestiocof {
|
|
|
|
# Daphne listens on a unix socket
|
|
|
|
server unix:/srv/gestiocof/gestiocof.sock;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
|
|
|
|
server_name localhost;
|
|
|
|
|
|
|
|
# All the trafic is routed to Daphne
|
2017-08-10 17:56:03 +02:00
|
|
|
location / {
|
2017-08-09 23:07:49 +02:00
|
|
|
# A copy-paste of what we have in production
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-SSL-Client-Serial $ssl_client_serial;
|
|
|
|
proxy_set_header X-SSL-Client-Verify $ssl_client_verify;
|
|
|
|
proxy_set_header X-SSL-Client-S-DN $ssl_client_s_dn;
|
2017-08-10 17:56:03 +02:00
|
|
|
|
2017-08-09 23:07:49 +02:00
|
|
|
# Reverse-proxy
|
|
|
|
proxy_pass http://gestiocof;
|
|
|
|
}
|
|
|
|
|
2017-08-10 17:56:03 +02:00
|
|
|
# Upgrading the connection when handling websockets
|
|
|
|
location /ws/ {
|
|
|
|
# A copy-paste of what we have in production
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-SSL-Client-Serial $ssl_client_serial;
|
|
|
|
proxy_set_header X-SSL-Client-Verify $ssl_client_verify;
|
|
|
|
proxy_set_header X-SSL-Client-S-DN $ssl_client_s_dn;
|
|
|
|
|
|
|
|
# See http://nginx.org/en/docs/http/websocket.html
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
|
|
|
|
proxy_pass http://gestiocof;
|
|
|
|
}
|
|
|
|
|
2017-08-09 23:07:49 +02:00
|
|
|
# Static files
|
2017-08-10 17:56:03 +02:00
|
|
|
location /static/ {
|
|
|
|
root /srv/gestiocof/;
|
2017-08-09 23:07:49 +02:00
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
expires 7d;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Uploaded media
|
2017-08-10 17:56:03 +02:00
|
|
|
location /media/ {
|
|
|
|
root /srv/gestiocof/;
|
2017-08-09 23:07:49 +02:00
|
|
|
access_log off;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
expires 7d;
|
|
|
|
}
|
|
|
|
}
|