Question

How do I change nginx routing on the rails/nginx preconfigured droplet on Ubuntu?

  • Posted on November 4, 2014
  • nickhallAsked by nickhall

I just installed the nginx/rails configuration with Ubuntu 14.10 and I’m trying to have nginx point to various folders that are separate from rails, but I can’t find any sites-available information, and it seems that /opt/nginx/conf/nginx.conf is also empty.

How can I add a simple route from “domain/stuff” to /var/www/stuff with this premade install?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Edit your server block (it should be in /etc/nginx/sites-enabled) and add the following location block:

location /stuff {
    alias /var/www/stuff; # map /stuff to /var/www/stuff
    index index.html; # assuming /var/www/stuff contain static files only
    try_files $uri $uri/ =404; # requests under /stuff shouldn't be passed to rails
}

Then restart nginx:

sudo service nginx restart