Passenger app only displays 'front' page

43 views
Skip to first unread message

Martin Aarhus Gregersen

unread,
Nov 2, 2016, 1:00:50 PM11/2/16
to Phusion Passenger Discussions
Heya,

So this is a bit weird to explain. Feel free to check out for yourself at : http://77.66.12.75/

I can't seem to access any layers/pages of my application, except for my frontpage.

What happens is that I am rendering the front-page of the sample web-app, but if I try to visit, for example, the login site, it throws an error (500, I think).
I can't figure out why, but I have a feeling that it is a matter of configuration on NGINX.

I hope you may be able to assist me with it.

nginx.conf:

user nginx;
worker_processes auto;
error_log /var/www/logs/nginx_error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    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  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    include             sites-enabled/*;
    default_type        application/octet-stream;


    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # for more information.
    include /etc/nginx/conf.d/*.conf;


}


and in nginx.conf I have another folder 'sites-enabled' in which I have 'cooking'.
The cooking looks like this (note that it is not .conf, but it appears to be unnesecary):

server {
        listen       80;
        server_name  77.66.12.75;
        root         /var/www/html/cooking/public;
        index index.php index.html index.htm;

        # Load configuration files for the default server block.
        passenger_enabled on;
        passenger_ruby /usr/local/rvm/gems/ruby-2.1.8/wrappers/ruby;
        include /etc/nginx/default.d/*.conf;

        location / {
         try_files $uri $uri.html $uri/ =404;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}



Hope you guys are able to help.

Thanks!

Camden Narzt

unread,
Nov 2, 2016, 3:03:51 PM11/2/16
to Phusion Passenger Discussions
The error I get when I visit http://77.66.12.75/recipes?locale=da is a 404, since you have several different approaches to serving pages, which way are you expecting this page to be served?

If you expect your ruby app to serve the page what do your routes look like?

Martin Aarhus Gregersen

unread,
Nov 2, 2016, 3:35:08 PM11/2/16
to Phusion Passenger Discussions
Hey Camden,

Thanks for pointing that out.

I am expecting it to get served... Yeah, I don't really know, as I don't know much about either nginx or passenger.
I know I've followed the guide at phuzion, for setting my application up with nginx, so that should be set in stone.

I would assume the location directive dictates which files to serve.
As for routes, I have everything set up with no errors in development, which is also causing me some confusion.

Daniel Knoppel

unread,
Nov 4, 2016, 3:06:10 AM11/4/16
to Phusion Passenger Discussions
Seems to work now? :)

- Daniel

Martin Aarhus Gregersen

unread,
Nov 4, 2016, 7:04:42 AM11/4/16
to Phusion Passenger Discussions
Hey Daniel,

No it does not :-( 
We should both be able to open the application, but we can't serve any files but the front page. 
At least I can't - I just re-checked

Camden Narzt

unread,
Nov 4, 2016, 2:18:45 PM11/4/16
to Phusion Passenger Discussions
I meant that you know your app, and you know which aspect is going to handle that url, I can't know if you expected that to be handled by the php part or ruby.

Are you using Passenger in development? If so I'd recommend that you look at the config generated by passenger in your development environment, since that works for you. You can do that by adding --debug-nginx-config to the end of your passenger start command.

If you aren't using Passenger in development then perhaps try simplifying your nginx config first then adding extra configuration only as necessary.

For example try this:

server {
        listen       80;
        server_name  77.66.12.75;
        root         /var/www/html/cooking/public;
        passenger_enabled on;
        passenger_ruby /usr/local/rvm/gems/ruby-2.1.8/wrappers/ruby;
}

Martin Aarhus Gregersen

unread,
Nov 5, 2016, 8:49:43 AM11/5/16
to Phusion Passenger Discussions
Hey again Camden.

I am not using passenger in development; I am not sure where the difference between what nginx and what passenger handles, lies. 
Good tips, they sound like proper debugging tips (that I didn't know anything about!).

I will see if that works for me.

Martin Aarhus Gregersen

unread,
Nov 5, 2016, 8:54:24 AM11/5/16
to Phusion Passenger Discussions
That did it Camden!

I commented out several lines of the cooking.conf file and that seem to accomplish it! 
I know waaay too little about these server setup-kind-of-things. Thanks again!

Thank you so much 

Den fredag den 4. november 2016 kl. 19.18.45 UTC+1 skrev Camden Narzt:
Reply all
Reply to author
Forward
0 new messages