RoR app, “Failed to load resource: the server responded with a status of 404 (Not Found)”

Jake He jake.he at gmail.com
Fri Oct 17 13:49:55 UTC 2014


Hi,

I am running a ruby application on Nginx. It is working fine on Apache.
When I try to load the ruby application on Nginx, I get this error: "Failed
to load resource: the server responded with a status of 404 (Not Found)" It
fails to find two .json files. I had the same issue with Apache before. It
was due to not having DocumentRoot in apache conf file. Once DocumentRoot
is defined to the public directory of the rails application, the 404 error
went away.

This is my Nginx conf file within the server block.

#owums
location ~ ^/wifi(/.*|$) {
    alias /var/www/owums/public$1;  # <-- be sure to point to 'public'!
    passenger_base_uri /wifi;
    passenger_app_root /var/www/owums;
    passenger_document_root /var/www/owums/public;
    passenger_enabled on;
    passenger_app_env development;}

This is my Apache conf file. When I comment out DocumentRoot
/var/www/owums/public in Apache conf, Apache will throw the same error.

Any ideas?

<VirtualHost *:80>Alias /wifi /var/www/owums/public
   <Location /wifi>
        PassengerBaseURI /wifi
        PassengerAppRoot /var/www/owums
    </Location>
    RailsEnv production
    ServerName wifi
    DocumentRoot /var/www/owums/public
    <Directory /var/www/owums/public>
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory></VirtualHost>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141017/6b241713/attachment-0001.html>


More information about the nginx mailing list