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?
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!
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.