Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx - passanger displays 404 not found for rails controllers

This is my first rails app i am deploying to a server other than heroku.I deployed my rails app to digitalocean successfuly. When i type the ipaddress in browser, home page shows up. But when i try to redirect to other controllers like xxx.xxx.xxx.xx/users/sign_in it show 404 Not Found. Also none of the images are showing up.

/etc/nginx/sites-enabled/default

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 = / {
           passenger_enabled on; <-added this line for home page to show up
        }
        location = /users/sign_in {
           passenger_enabled on; <-added this line for sign_in view to show up
        }
}

I dont know what i am missing. do I have to add passenger_enabled on; to each location?or is there a common configuration for all the uri's of the application?

like image 661
Arun Avatar asked Dec 02 '22 16:12

Arun


1 Answers

I fixed it. Removed all location and added passenger_enabled on; outside.

like image 109
Arun Avatar answered Dec 06 '22 22:12

Arun