Question

404 Nginx error - Ubuntu 14.04 Rails

Hey guys,

I am following this tutorial with my own rails project: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-nginx-on-ubuntu-14-04

And I keep arriving at a 404 Nginx not found error. Printing out the log I recieved this error: 2014/11/16 14:08:13 [error] 20149#0: *29 “/home/rails/whattodo/public/index.html” is not found (2: No such file or directory), client: 70.52.174.228, server: , request: “GET / HTTP/1.1”, host: “104.131.76.121” 2014/11/16 14:08:14 [error] 20149#0: *29 open() “/home/rails/whattodo/public/favicon.ico” failed (2: No such file or directory), client: 70.52.174.228, server: , request: “GET /favicon.ico HTTP/1.1”, host: “104.131.76.121”.

Here is my nginx file: server { listen 80 default_server; passenger_enabled on; passenger_app_env development; root /home/rails/whattodo/public; }

I added this file, even though I didn’t think it would be necessary, and still the error remains. Any help or directions you think I should be heading to solve this problem would be greatly appreciated!

Show comments

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.

The best solution I could find to this after searching a lot was to re-install and configure nginx with phusion passenger

sudo apt-get purge nginx nginx-common nginx-full
sudo apt-get install nginx
sudo nano /etc/nginx/nginx.conf
# uncomment 'passenger_root' & 'passenger_ruby' paths accordingly
sudo nano /etc/nginx/sites-enabled/default
# replace with:
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    server_name mydomain.com;
    passenger_enabled on;
    rails_env    production;
    root         /home/deploy/myapp/current/public;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}
sudo service nginx restart