poulpe/provisioning/nginx.conf
Martin Pépin e64c3d0b37 Setup a production-like environment in vagrant
- We already use Daphne and channels to prepare the future use of
  websockets.
- The app is served behind an nginx reverse-proxy
- The services we need are managed by systemctl

The production-like running instance of GestionÉvénementiel can be
accessed on localhost:8080 outside vagrant.
2017-05-16 16:13:31 +01:00

40 lines
969 B
Nginx Configuration File

upstream GE {
# Daphne listens on a unix socket
server unix:/srv/GE/GE.sock;
}
server {
listen 80;
server_name localhost;
# All the trafic is routed to Daphne
location ~ ^/ {
# 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;
# Reverse-proxy
proxy_pass http://GE;
}
# Static files
location ~ ^/static/ {
root /srv/GE/static/;
access_log off;
add_header Cache-Control "public";
expires 7d;
}
# Uploaded media
location ~ ^/media/ {
root /srv/GE/static/;
access_log off;
add_header Cache-Control "public";
expires 7d;
}
}