Skip to content

Instantly share code, notes, and snippets.

@poga
Last active April 15, 2017 15:34
Show Gist options
  • Save poga/de6914921759473fb33787352827ad5a to your computer and use it in GitHub Desktop.
Save poga/de6914921759473fb33787352827ad5a to your computer and use it in GitHub Desktop.
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name <YOUR DOMAIN NAME>;
return 301 https://$host$request_uri;
}
server {
include /etc/nginx/mime.types;
listen 443 ssl;
server_name <YOUR DOMAIN NAME>;
ssl_protocols TLSv1.2;
ssl_ciphers EECDH+AESGCM:EECDH+AES;
ssl_ecdh_curve prime256v1;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_certificate /<YOUR CERTIFICATE PATH>/fullchain.pem;
ssl_certificate_key /<YOUR CERTIFICATE PATH>/privkey.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 0;
gzip off;
root /<YOUR MASTODON PATH>/public;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
location / {
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_pass_header Server;
proxy_pass http://localhost:3000;
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_pass http://localhost:4000;
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 503 504 /500.html;
}
}
events {
worker_connections 4096; ## Default: 1024
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment