intranet.nginx 1022 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11
upstream app_server {
    server unix:/tmp/gunicorn-intranet.sock fail_timeout=0;
}

server {
    listen          80;
    server_name     intranet2.crans.org;
 
    rewrite ^/(.*) https://$server_name/$1 permanent;
}

12 13 14 15 16 17 18
server {
    listen          80;
    server_name     intranet2;
 
    rewrite ^/(.*) https://$server_name.crans.org/$1 permanent;
}

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
server {
    listen 443;
    
    ssl on; 

    ssl_certificate /etc/ssl/certs/intranet_server.pem;
    ssl_certificate_key /etc/ssl/private/intranet_privatekey.pem;
    keepalive_timeout    70;

    access_log      /var/log/nginx/intranet.log;

    location / {
        root /usr/local/django/intranet/;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        proxy_pass http://app_server;
    }

    location /static {
        alias /usr/local/django/intranet/static;
    }
    
43 44 45 46
    location /media {
        alias /usr/share/pyshared/django/contrib/admin/media;
    }
    
47 48
}