How do I set up a subdomain to run with Meteor?

Posted July 31, 2016 3.3k views
NginxConfiguration Management


I am running meteor with Nginx on my Ubuntu droplet, and would like to configure a subdomain to serve up static files at The DNS tutorial worked a treat, but my attempts to use the tutorial on NGINX config here was unsuccessful. Upon running service [my app name] restart, the process fails.

Attempts to work around this issue came up short. For example, adding another server { } block (with the relevant other info) into the preexisting nginx config file, disabling the default_server setting and trying various approaches that way didn’t work. The closest I got was to get the Meteor app mirrored on my subdomain, instead of serving up the files at the public_html document root given in the tutorial.

Of course, I noticed the comment in the nginx config saying “root is irrelevant,"—now that’s where I’m stuck. Googling didn’t turn up any further info to help with that. So, I would be deeply thankful if someone could point me in the right direction. I’m so close to launching this app, a year in the making, and I need a lifeline.

Yours very truly,


1 comment
  • Can you share your current nginx server block(s)? Creating a second server block to serve static content should be pretty straightforward and I should be able to take your existing server block and help you craft an updated nginx configuration.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi Ryan,

I managed to resolve this issue, thanks to reading the tutorial here. Turns out running a separate subdomain wasn’t necessary (though it is certainly possible). Instead, I just needed to understand how block and location selection works in nginx.

Thanks for reaching out! :)

by Justin Ellingwood
Nginx is one of the most popular web servers in the world. In this guide, we will discuss how Nginx selects the server and location block that will handle a given client's request. We will go over the algorithm in place, as well as the directives and options you can use to modify the selection process.