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;
|
2020-12-04 16:09:59 +01:00
|
|
|
listen [::]:80;
|
2017-08-09 23:07:49 +02:00
|
|
|
|
2020-12-04 16:09:59 +01:00
|
|
|
server_name _;
|
2017-08-13 15:36:45 +02:00
|
|
|
root /srv/gestiocof/;
|
2017-08-09 23:07:49 +02:00
|
|
|
|
2020-12-04 16:09:59 +01:00
|
|
|
# Redirection:
|
|
|
|
rewrite ^/$ http://localhost:8080/gestion/ redirect;
|
|
|
|
rewrite ^/gestion$ http://localhost:8080/gestion/ redirect;
|
2017-08-10 17:56:03 +02:00
|
|
|
|
2020-12-04 16:09:59 +01:00
|
|
|
# Les pages statiques sont servies à part.
|
|
|
|
location /gestion/static { try_files $uri $uri/ =404; }
|
|
|
|
location /gestion/media { try_files $uri $uri/ =404; }
|
2017-08-13 15:36:45 +02:00
|
|
|
|
2020-12-04 16:09:59 +01:00
|
|
|
# On proxy-pass les requêtes vers les pages dynamiques à daphne
|
|
|
|
location / {
|
2017-08-10 17:56:03 +02:00
|
|
|
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;
|
2020-12-04 16:09:59 +01:00
|
|
|
proxy_pass http://gestiocof;
|
|
|
|
}
|
2017-08-09 23:07:49 +02:00
|
|
|
|
2020-12-04 16:09:59 +01:00
|
|
|
# Pour les websockets :
|
|
|
|
# See http://nginx.org/en/docs/http/websocket.html.
|
|
|
|
location /ws/ {
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "upgrade";
|
|
|
|
proxy_pass http://gestiocof/ws/;
|
2017-08-09 23:07:49 +02:00
|
|
|
}
|
|
|
|
}
|