diff --git a/conf/nginx.conf b/conf/nginx.conf index f90d0fb..8a76cee 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,28 +4,46 @@ location / { rewrite ^ https://$server_name$request_uri? permanent; } - gzip off; - proxy_http_version 1.1; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml; - # For Websocket support + # the nginx default is 1m, not enough for large media uploads + client_max_body_size 16m; + + proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; - - proxy_redirect off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://localhost:__PORT__; - client_max_body_size 16m; - location ~* \.(css|js)$ { root __FINALPATH__/mobilizon/priv/static; etag off; - expires 1y; access_log off; - add_header Cache-Control public; + add_header Cache-Control "public, max-age=31536000, immutable"; + } + + location ~ ^/(media|proxy) { + etag off; + access_log off; + add_header Cache-Control "public, max-age=31536000, immutable"; + proxy_pass http://localhost:__PORT__; + } + + error_page 500 501 502 503 504 @error; + location @error { + root __FINALPATH__/mobilizon/priv/errors; + try_files /error.html 502; } # Include SSOWAT user panel.