80 lines
2.0 KiB
Plaintext
80 lines
2.0 KiB
Plaintext
access_log "/var/log/nginx/mastodon.access.log";
|
|
error_log "/var/log/nginx/mastodon.error.log";
|
|
|
|
keepalive_timeout 70;
|
|
|
|
sendfile on;
|
|
client_max_body_size 0;
|
|
|
|
root <%= @mastodon_path %>/public;
|
|
|
|
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;
|
|
|
|
location / {
|
|
# If the maintenance file is present, show maintenance page
|
|
if (-f <%= @mastodon_path %>/public/maintenance.html) {
|
|
return 503;
|
|
}
|
|
|
|
try_files $uri @proxy;
|
|
}
|
|
|
|
location /sw.js {
|
|
add_header Cache-Control "max-age=0, no-cache, no-store, must-revalidate";
|
|
add_header Pragma "no-cache";
|
|
}
|
|
|
|
location ~ ^/(emoji|packs|system/accounts/avatars|system/media_attachments/files) {
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
try_files $uri @proxy;
|
|
}
|
|
|
|
location @proxy {
|
|
proxy_set_header Host $host;
|
|
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 https;
|
|
proxy_set_header Proxy "";
|
|
proxy_pass_header Server;
|
|
|
|
proxy_pass http://localhost:<%= @puma_port %>;
|
|
proxy_buffering off;
|
|
proxy_redirect off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
tcp_nodelay on;
|
|
}
|
|
|
|
location /api/v1/streaming {
|
|
proxy_set_header Host $host;
|
|
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 https;
|
|
proxy_set_header Proxy "";
|
|
|
|
proxy_pass http://localhost:<%= @streaming_port %>;
|
|
proxy_buffering off;
|
|
proxy_redirect off;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
|
|
tcp_nodelay on;
|
|
}
|
|
|
|
error_page 500 501 502 504 /500.html;
|
|
error_page 503 /maintenance.html;
|
|
|
|
location = /maintenance.html {
|
|
root <%= @mastodon_path %>/public;
|
|
}
|