Skip to content

Instantly share code, notes, and snippets.

@audiodude
Created April 10, 2017 05:18
Show Gist options
  • Select an option

  • Save audiodude/926abe2997f210ad55e6a674109008a2 to your computer and use it in GitHub Desktop.

Select an option

Save audiodude/926abe2997f210ad55e6a674109008a2 to your computer and use it in GitHub Desktop.
nginx configuration for Mastodon
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name example.com;
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 /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
keepalive_timeout 70;
sendfile on;
client_max_body_size 0;
gzip off;
root /home/mastodon/live/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;
}
Copy link

ghost commented May 6, 2020

https://gist.github.com/audiodude/926abe2997f210ad55e6a674109008a2#file-example-com-conf-L23

These two lines need to point to the proper lets-encrypt for you (usually something like /etc/letsencrypt/live/glam.monster/fullchain.pem; )

This needs to be the directory you installed corgidon into so like /installed-dir/live/public
https://gist.github.com/audiodude/926abe2997f210ad55e6a674109008a2#file-example-com-conf-L31
For me it reads /srv/banana.dog/ live/public but for you its whereever you placed the docker-compose file.

And this one needs to be your domain obv
https://gist.github.com/audiodude/926abe2997f210ad55e6a674109008a2#file-example-com-conf-L15

Other than these it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment