upstream rosa_build_backend { # server 127.0.0.1:8080; server unix:/tmp/rosa_build_unicorn.sock; } server { listen 80; server_name rosa-build.rosalab.ru; root /srv/rosa_build/current/public; if ($uri !~ downloads) { rewrite ^(.*) https://$host$1 permanent; } location /downloads { autoindex on; } access_log /srv/rosa_build/shared/log/nginx.access.log; error_log /srv/rosa_build/shared/log/nginx.error.log; #rewrite ^/downloads/(.*) http://$host/downloads/$1 break; } server { listen 443 default ssl; server_name 195.19.77.242; root /srv/rosa_build/current/public; ssl on; ssl_certificate /etc/ssl/rosalinux.crt; ssl_certificate_key /etc/ssl/rosalinux.key; #ssl_verify_depth 3; #location /downloads { #autoindex on; #} try_files $uri/index.html $uri.html $uri @myapp; location @myapp { proxy_pass http://rosa_build_backend; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 300; proxy_send_timeout 180; proxy_redirect off; } rewrite ^/downloads/(.*) http://$host/downloads/$1 break; #access_log /srv/rosa_build/shared/log/nginx.access.log; #error_log /srv/rosa_build/shared/log/nginx.error.log; error_page 500 502 503 504 /500.html; location = /500.html { root /srv/rosa_build/current/public; } }