nginx_conf.in 3.22 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
worker_processes {{ param_nginx_frontend['nb_workers'] }};

pid {{ param_nginx_frontend['path_pid'] }};
error_log {{ param_nginx_frontend['path_error_log'] }};

daemon off;

events {
	worker_connections 1024;
	accept_mutex off;
}

http {
     default_type application/octet-stream;
     access_log {{ param_nginx_frontend['path_access_log'] }} combined;
16 17 18 19
     map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
     }
20 21 22 23 24 25 26 27 28 29 30 31 32
     server {
        listen [{{ param_nginx_frontend['global-ip'] }}]:{{ param_nginx_frontend['global-port'] }} ssl;
        server_name _;
        ssl_certificate     {{ param_nginx_frontend['ssl-certificate'] }};
        ssl_certificate_key {{ param_nginx_frontend['ssl-key'] }};
        ssl_protocols       SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers         HIGH:!aNULL:!MD5;
        keepalive_timeout 90s;
        client_body_temp_path {{ param_tempdir['client_body_temp_path'] }};
        proxy_temp_path {{ param_tempdir['proxy_temp_path'] }};
        fastcgi_temp_path {{ param_tempdir['fastcgi_temp_path'] }};
        uwsgi_temp_path {{ param_tempdir['uwsgi_temp_path'] }};
        scgi_temp_path {{ param_tempdir['scgi_temp_path'] }};
33
	error_page 401 /login;
34
        location / {
35
            auth_basic "Restricted";
36 37
            auth_basic_user_file {{ param_nginx_frontend['etc_dir'] }}/.htpasswd;
            proxy_redirect off;
38 39 40 41
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host  $http_host;
            proxy_set_header   X-Accel-Mapping   /private/;
42 43

            proxy_pass http://unix:{{ socket }};
44
        }
45
        location ~ ^(/login|/doLogin|/static|/setAccount|/configAccount|/slapgridResult|/isSRReady) {
46
            proxy_redirect off;
47 48 49 50
            proxy_set_header   X-Forwarded-Proto $scheme;
            proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Host  $http_host;
            proxy_set_header   X-Accel-Mapping   /private/;
51 52

            proxy_pass http://unix:{{ socket }};
53
        }
54
	location /shellinabox {
55
            proxy_pass  http://[{{ param_nginx_frontend['global-ip'] }}]:{{ shellinabox_port }}/;
56
            proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
57
            auth_basic "Restricted";
58
            auth_basic_user_file {{ param_nginx_frontend['etc_dir'] }}/.htpasswd;
59 60 61 62
            proxy_redirect off;
            proxy_buffering off;
            proxy_set_header        Host              $host;
            proxy_set_header        X-Real-IP         $remote_addr;
63
	    proxy_set_header        X-Forwarded-Proto $scheme;
64
            proxy_set_header        X-Forwarded-For   $proxy_add_x_forwarded_for;
65
	    proxy_set_header        X-Forwarded-Host  $http_host;
66
	}
67 68 69 70 71 72 73 74 75 76 77 78 79
        location /share {
            rewrite ^/share / break;

            auth_basic "Restricted";
            auth_basic_user_file {{ param_nginx_frontend['etc_dir'] }}/.htpasswd;

            dav_methods PUT DELETE MKCOL COPY MOVE;
            dav_ext_methods PROPFIND OPTIONS;

            root {{ param_nginx_frontend['work_dir'] }};

            create_full_put_path   on;
        }
80
    }
81
}