nginx_web2py 2.83 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
            proxy_read_timeout 600;
            client_max_body_size 20G;
            ###
        }
marc duez's avatar
marc duez committed
34 35 36 37 38 39 40
        
        location / {
            root /usr/share/vidjil/browser;       
            rewrite ^/([0-9]+)-([0-9]+)/(css|js|image|test)/(.*) /$3/$4 redirect;
            rewrite ^/([0-9]+)-([0-9]+)/ /?set=$1&config=$2 redirect;
            rewrite ^/([0-9]+)-([0-9]+) /?set=$1&config=$2 redirect;
            
marc duez's avatar
marc duez committed
41
            expires 1h;
marc duez's avatar
marc duez committed
42
            add_header Cache-Control must-revalidate;
marc duez's avatar
marc duez committed
43 44 45

            error_page 405 = $uri;
        }
marc duez's avatar
marc duez committed
46 47 48 49 50 51 52
        
        location /browser {
            root /usr/share/vidjil;       
            rewrite ^/browser/([0-9]+)-([0-9]+)/(css|js|image|test)/(.*) /browser/$3/$4 redirect;
            rewrite ^/browser/([0-9]+)-([0-9]+)/ /browser/?set=$1&config=$2 redirect;
            rewrite ^/browser/([0-9]+)-([0-9]+) /browser/?set=$1&config=$2 redirect;
            
Ryan Herbert's avatar
Ryan Herbert committed
53
            expires 1h;
marc duez's avatar
marc duez committed
54
            add_header Cache-Control must-revalidate;
Ryan Herbert's avatar
Ryan Herbert committed
55 56

            error_page 405 = $uri;
57
        }
marc duez's avatar
marc duez committed
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
}