Nginx + Passenger: 404 errors, not running rails application

1,627 views
Skip to first unread message

fegul

unread,
Jun 3, 2010, 1:43:57 PM6/3/10
to Phusion Passenger Discussions
I've tried to get Nginx and Passenger working properly several times
on Ubuntu (I've used 9.10, 10.04, and both server and desktop
versions) I've been using virtual machines, physical boxes, etc. still
I run into this error:

Nginx serves up the static "Welcome Aboard" page and when I click on
"application environment" or try to access a controller, I just get a
404 error and the logs state "no such file or directory"

To install nginx, I followed the docs on the Passenger site and ran
through the automatic option where the lines with the location of
passenger and ruby are automatically inserted and I specified
"passenger_enabled on;" in the server block and set rails_env to
development.

I'm wondering if it's a permissions error (in order to run passenger-
status without permission errors I have to use sudo) but I'm not sure.

Any ideas?

Hongli Lai

unread,
Jun 3, 2010, 2:04:31 PM6/3/10
to phusion-...@googlegroups.com
On Thu, Jun 3, 2010 at 7:43 PM, fegul <ftse...@gmail.com> wrote:
> Nginx serves up the static "Welcome Aboard" page and when I click on
> "application environment" or try to access a controller, I just get a
> 404 error and the logs state "no such file or directory"

"application environment" only works with RAILS_ENV=development. On
Phusion Passenger RAILS_ENV defaults to production.


--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

fegul

unread,
Jun 4, 2010, 8:53:23 AM6/4/10
to Phusion Passenger Discussions
Right, which is why I set rails_env to development in nginx. Beyond
that though, I still can't access any controllers

On Jun 3, 2:04 pm, Hongli Lai <hon...@phusion.nl> wrote:
> On Thu, Jun 3, 2010 at 7:43 PM, fegul <ftseg...@gmail.com> wrote:
> > Nginx serves up the static "Welcome Aboard" page and when I click on
> > "application environment" or try to access a controller, I just get a
> > 404 error and the logs state "no such file or directory"
>
> "application environment" only works with RAILS_ENV=development. On
> Phusion Passenger RAILS_ENV defaults to production.
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl

Hongli Lai

unread,
Jun 4, 2010, 9:17:45 AM6/4/10
to phusion-...@googlegroups.com
If you have any 'location' blocks then you need to re-specify
passenger_enabled in them.

On Fri, Jun 4, 2010 at 2:53 PM, fegul <ftse...@gmail.com> wrote:
> Right, which is why I set rails_env to development in nginx.  Beyond
> that though, I still can't access any controllers

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl

fegul

unread,
Jun 4, 2010, 11:29:03 AM6/4/10
to Phusion Passenger Discussions
Wow. And just like that it worked! :) did I just happen to miss that
in the documentation or something?

On Jun 4, 9:17 am, Hongli Lai <hon...@phusion.nl> wrote:
> If you have any 'location' blocks then you need to re-specify
> passenger_enabled in them.
>
> On Fri, Jun 4, 2010 at 2:53 PM, fegul <ftseg...@gmail.com> wrote:
> > Right, which is why I set rails_env to development in nginx.  Beyond
> > that though, I still can't access any controllers
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl

Gabriel Madeira

unread,
May 19, 2014, 1:24:56 PM5/19/14
to phusion-...@googlegroups.com
Hi, reading this post I have the same problem. But still cannot access my rails app. My NGINX config file is like that:


user  gabrielmadeira staff;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
  #passenger_root /usr/local/opt/passenger;
  passenger_root /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini;
  passenger_ruby /Users/gabrielmadeira/.rvm/gems/ruby-2.1.0@filx/wrappers/ruby;
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  rv.local;
 
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

       location / {
        rails_env          development;
        root   /Users/gabrielmadeira/Google\ Drive/Apps/Rep/public;
        access_log /Users/gabrielmadeira/Google\ Drive/Apps/Rep/log/nginx_access.log;
        error_log /Users/gabrielmadeira/Google\ Drive/Apps/Rep/log/nginx_error.log;
        passenger_enabled on;
        index  index.html index.htm;
       }

        #error_page  404              /404.html;

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

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

But still getting the 404 not found error. Do you have any idea of what am I missing ?
thank you 

Tinco Andringa

unread,
Jun 13, 2014, 5:51:38 AM6/13/14
to phusion-...@googlegroups.com
Hi,

Sorry for the late response. Did you get it working? I see nothing
clearly wrong, is there something in your nginx error log? (check both
the system wide one and the one you specified).

Kind regards,
Tinco
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/phusion-passenger.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/phusion-passenger/eeb70e0c-20d1-448c-8fec-477dc34302ac%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Phusion | Web application deployment, scaling and monitoring solutions
Reply all
Reply to author
Forward
0 new messages