Subfolder Can't Be Used While Running Mastodon

Mastodon takes over subfolder and now having problem anything to run from subfolder

Mastodon url: www.example.com
Another app: www.example.com/app1
Another app: www.example.com/app2

configuration of nginx: documentation/Production-guide.md at master · tootsuite/documentation · GitHub

Hope that makes sense. Please help!

did you configure ngnix to serve the subfolder apps?

Yes. If I delete mastodon.conf and restart nginx then everything works fine

Well, yeah, you can’t have two server blocks with the same domain. you need to put the configuration for the subfolder apps inside of the mastodon configuration.

1 Like

Here’s a good introduction on the topic: Server Block Examples | NGINX and this page goes into more details if you’re interested: Understanding Nginx Server and Location Block Selection Algorithms | DigitalOcean

I was trying to use two seperate file to keep it clean and following this

/etc/nginx/sites-available/mastodon.conf
/etc/nginx/sites-available/app1.conf

Will keep all config inside mastodon.conf per your suggestion

Thank you!

the stackoverflow guide you linked is for different domains. sites-available should be for different domains only. You can keep the configuration file separate by putting them in a different folder, like snippets or includes and using explicit include directives, like so:

server {

    server_name YOUR_DOMAIN;

    location / {
        # whatever mastodon stuff
    }

    include includes/mailman;
    include includes/discourse;
}
1 Like