I am trying to follow various tutorials on setting up a Mastodon stack. I am using Swag as my reverse proxy, and cannot get my mastodon.subdomain.conf file to work. Is there anyone who has gotten Mastodon working with Swag? I’m getting a “502 Bad Gateway” error.
My conf file:
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name mast.example.net;
include /config/nginx/ssl.conf;
client_max_body_size 0;
location / {
try_files $uri @proxy;
}
location ~ ^/(emoji|packs|system/accounts/avatars|system/media_attachments/files) {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri @proxy;
}
location /sw.js {
add_header Cache-Control "public, max-age=0";
try_files $uri @proxy;
}
location @proxy {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app mastodon_web_1;
set $upstream_port 3005;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
}
location /api/v1/streaming {
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app mastadon_streaming_1;
set $upstream_port 4005;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}
I revisted this problem, and got it working using the linuxserver.io image, instead of the one I was trying last year. The linuxserver.io documentation is a little vague on the steps to get Mastodon running. You need to generate your secrets to add to your docker-compose.yml or secrets file BEFORE spinning up the container:
docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon generate-secret SECRET_KEY_BASE
docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon generate-secret OTP_SECRET
The third command generates both the VAPID_PRIVATE_KEY and VAPID_PUBLIC_KEY
docker run --rm -it --entrypoint /bin/bash lscr.io/linuxserver/mastodon generate-vapid
After you have generated the secrets, add them to your docker-compose.yml file (also editing your smtp, database information, etc), and run the container.