nginx_web2py 2.66 KB
Newer Older
1 2 3 4
upstream uwsgi {
    server uwsgi:8000;
}

5 6 7 8 9 10 11 12 13
server {
        listen 80;
        server_name     $hostname;

        location / {
                return 301 https://$host/browser;
        }
}

14 15 16 17 18 19 20 21 22 23 24
server {
        listen 443 default_server ssl;
        server_name     $hostname;
        ssl_certificate         /etc/nginx/ssl/web2py.crt;
        ssl_certificate_key     /etc/nginx/ssl/web2py.key;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
        ssl_session_timeout 10m;
        ssl_ciphers ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        keepalive_timeout    70;
25

26
        uwsgi_max_temp_file_size 20480m;
27

28
        location ~ ^/(vidjil|admin) {
29
            include /etc/nginx/conf.d/web2py/uwsgi.conf;
30 31 32 33 34 35 36 37
            proxy_read_timeout 600;
            client_max_body_size 20G;
            ###
        
        }
        ## if you serve static files through https, copy here the section
        ## from the previous server instance to manage static files

38 39 40 41 42
        location ~ ^/(css|js|images|test) {
            root /usr/share/vidjil/browser/;
            expires 1h;

            error_page 405 = $1;
43
        }
Ryan Herbert's avatar
Ryan Herbert committed
44

Ryan Herbert's avatar
Ryan Herbert committed
45 46
        location ~ ^/(client|c) {
            rewrite /(client|c) /browser;
Ryan Herbert's avatar
Ryan Herbert committed
47 48 49
        }

        location /browser {
50
            rewrite /browser/([0-9]+)/([0-9]+)(\/?) /browser/?set=$1&conf=$2 break;
Ryan Herbert's avatar
Ryan Herbert committed
51 52 53 54 55 56 57
            rewrite /browser/([0-9/]+)/(css|js|images|test)/(.*) /browser/$2/$3 redirect;
            root /usr/share/vidjil;
            expires 1h;
            add_header Cache-Control must-revalidate;

            error_page 405 = $uri;

58 59
        }

60 61 62
    location /germline {
        root /usr/share/vidjil/;
        expires 1h;
63
        add_header Cache-Control must-revalidate;
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89

        error_page 405 = $uri;
    
    }

    ###to enable correct use of response.static_version
    #location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
        #    alias /usr/share/vidjil/server/web2py/applications/$1/static/$2;
        #    expires max;
        #
    #}
    ###

    client_max_body_size 20G;

    location /cgi/ {
        gzip off;
        root  /usr/share/vidjil/browser/;
        # Fastcgi socket
        fastcgi_pass  unix:/var/run/fcgiwrap.socket;
        # Fastcgi parameters, include the standard ones
        include /etc/nginx/fastcgi_params;
        # Adjust non standard parameters (SCRIPT_FILENAME)
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    
    }
90 91 92 93 94 95

    location /vidjil/file/upload {
        include /etc/nginx/conf.d/web2py/uwsgi.conf;
        uwsgi_read_timeout 10m;
        client_max_body_size 20G;
    }
96
}