Question

Ubuntu 18.04 + Nginx + Passenger : not serving any pages

Posted January 5, 2020 628 views
Ruby on RailsNginxUbuntu 18.04

Hi,

i’m trying to set up a RoR + Nginx/Passenger environment, using this tutorial : https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-18-04

However, i’m facing this following issue : despite the fact that my rails server is running, i can not see any page if i go to http://my_IP_address:3000.

As mentionned in the tutorial, i’ve modified my Nginx configuration file as followed :

server {
  listen 127.0.0.1:3000 default_server;
  #server_name example.com;
  passenger_enabled on;
  passenger_app_env development;
  root /home/rails/testapp/public;
}

This is what i get when i do a :

root@ubuntu-s-1vcpu-1gb-ams3-01:/home/rails/testapp# netstat -plant

–>

Active Internet connections (servers and established)

Proto
Recv-Q
Send-Q
Local Address
Foreign Address
State
PID/Program name

tcp
0
0 0.0.0.0:80
0.0.0.0:*
LISTEN
12469/nginx: master

tcp
0
0
127.0.0.53:53
0.0.0.0:*
LISTEN
26794/systemd-resol

tcp
0
0
0.0.0.0:22
0.0.0.0:*
LISTEN
953/sshd

tcp
0
0
127.0.0.1:3000
0.0.0.0:*
LISTEN
30875/puma 4.3.1 (t

tcp
0
0
178.62.224.137:22
86.208.49.163:53641
ESTABLISHED 30568/sshd: rails [

tcp
0
464
178.62.224.137:22
86.208.49.163:53226
ESTABLISHED 27641/sshd: root@pt

tcp
0
0
178.62.224.137:22
86.208.49.163:52900
ESTABLISHED 22558/sshd: root@no

tcp6
0
0
:::22
:::*
LISTEN
953/sshd

tcp6
0
0
::1:3000
:::*
LISTEN
30875/puma 4.3.1 (t

Is there somebody who could help me please ?

Thank you very much
Geoffrey

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.

×
1 answer

Hello,

You would need to setup Nginx as a reverse proxy for your Passenger application. You can follow this guide here on how to setup Nginx as a reverse proxy:

https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-web-server-and-reverse-proxy-for-apache-on-one-ubuntu-18-04-server

You can skip the first few steps and start from step 6. The important part is the proxy_pass configuration.

On another note, you can not have 2 services listening on the same port, for example, if your Passenger is listening on port 3000 you can not set Nginx to listen on port 3000 as well as one of the services would not be able to start.

Hope that this helps!
Regards,
Bobby

by Jesin A
In this tutorial you'll configure Nginx as both a web server and as a reverse proxy for Apache to host four domains on a single server.
Submit an Answer