Passenger Standalone does not appear to be responding to an Apache Reverse Proxy

80 views
Skip to first unread message

nexar

unread,
Apr 12, 2017, 6:52:40 AM4/12/17
to Phusion Passenger Discussions
I can start my Passenger Standalone successfully after changing into my local web site's root directory using the following command:

passenger start -a 127.0.0.1 -p 3001

My Apache VirtualHost looks like this:

<VirtualHost *:80> 
ServerName gi
DocumentRoot /home/purvez/www/gi/public 
#RailsEnv development
#PassengerEnabled off
ProxyPassMatch .*\.php$ !
ProxyPassReverse / http://127.0.0.1:3001/
ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
</VirtualHost>

I have the following entry in amongst other entries on my /etc/hosts file

127.0.0.1  gi

proxy and proxy_http both appear within /etc/apache2/mods-enabled


When I try to access gi from a web page I instead get the Apache2 Ubuntu Default Page.  However if I try to access gi:3001 then I get my site correctly served up.  This is making me think that it is Passenger Standalone that is serving the site rather than via Apache2.  To prove that I stopped the Apache2 service and I could still access the site using gi:3001.

All help / advice to make the Reverse Proxy work would be gratefully accepted with thanks.


Camden Narzt

unread,
Apr 12, 2017, 9:38:30 AM4/12/17
to Phusion Passenger Discussions
In my experience the order of proxy statements and other config options matters. Also are there actually php files to be ignored? If not just remove that line and try something like this:


<VirtualHost *:80>
    ServerName gi
    ProxyPreserveHost On
    ProxyPass /public !

    ProxyPass / http://127.0.0.1:3001/
    ProxyPassReverse / http://127.0.0.1:3001/
    DocumentRoot /home/purvez/www/gi/public
</VirtualHost>

On a side note, is there a reason you aren't using mod_passenger to work with apache? It's faster.

nexar

unread,
Apr 12, 2017, 12:07:58 PM4/12/17
to Phusion Passenger Discussions
Hi Camden Narzt.  Thanks for responding.  I was following these instructions:


I do have some php being served up as well so I do need to keep the 'ignore php' line in.

The reason I'm not using mod passenger is because this is a development machine with a number of sites with different versions of ruby etc.  Currently it's not working anywhere and I'm beginning to think that this may not be a passenger issue but an apache one. 

Camden Narzt

unread,
Apr 12, 2017, 12:11:37 PM4/12/17
to Phusion Passenger Discussions
FYI you can use a different version of ruby per site even when using mod_passenger. You just set the PassengerRuby option for each virtual host https://www.phusionpassenger.com/library/config/apache/reference/#passengerruby

nexar

unread,
Apr 12, 2017, 12:58:11 PM4/12/17
to Phusion Passenger Discussions
Camden I know this is a bit 'out of bounds' but I just reported the issue on askubuntu as an apache2 related one here:


If you are able to look at that and have any thoughts regarding that then that would help me move forward.  However I'm now fairly convinced that this is not a Passenger related issue at all.  Thanks in advance for any help you can give.

nexar

unread,
Apr 18, 2017, 8:21:41 AM4/18/17
to Phusion Passenger Discussions
Hi Camden

I hope you are still subscribed to this.  Having gone back to Apache for help it appears that the reason Apache is failing is because nginx is grabbing port80.  As far as I know I have never installed nginx on my system....other than whatever got installed as part of the Passenger Standalone configuration.

Please would you be able to tell me whether nginx could be grabbing port 80 and therefore preventing Apache from starting properly?

Here is the output from netstat -plnt:

================
 sudo netstat -plnt
sudo: unable to resolve host 127.0.1.1purvez-Aspire-5750: No such file or directory
[sudo] password for purvez: 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      1296/mysqld     
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      1994/smbd       
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1424/nginx -g daemo
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      1462/dnsmasq    
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      1994/smbd       
tcp6       0      0 :::139                  :::*                    LISTEN      1994/smbd       
tcp6       0      0 :::80                   :::*                    LISTEN      1424/nginx -g daemo
tcp6       0      0 :::445                  :::*                    LISTEN      1994/smbd       
purvez@127:~$ 


Your guidance would be greatly appreciated with thx.

Camden Narzt

unread,
Apr 18, 2017, 9:27:02 AM4/18/17
to Phusion Passenger Discussions
Nginx as part of Passenger standalone grabs port 3000 by default and you configure it to grab 3001, so it's strange that it is grabbing port 80, can you run sudo ls -l /proc/1424/exe and ps -l -p 1424 to try and determine how nginx was run?

nexar

unread,
Apr 18, 2017, 10:49:48 AM4/18/17
to Phusion Passenger Discussions
Camden  the following are the outputs from the 2 commands.:
==========

purvez@127:~$ sudo ls -l /proc/1424/exe
sudo: unable to resolve host 127.0.1.1purvez-Aspire-5750: No such file or directory
[sudo] password for purvez: 
lrwxrwxrwx 1 root root 0 Apr 18 15:46 /proc/1424/exe -> /usr/sbin/nginx
purvez@127:~$ ps -l -p 1424
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
5 S     0  1424     1  0  80   0 - 44608 -      ?        00:00:00 nginx
purvez@127:~$ 
==================
It does look like nginx is being started by root although I have NO IDEA what the ps -l -p 1424 command is saying.  Please decipher.  

Thanks for your continued help.

Camden Narzt

unread,
Apr 18, 2017, 11:05:14 AM4/18/17
to Phusion Passenger Discussions
The ps output didn't have any interesting info in it, unfortunately. Can you run /usr/sbin/nginx -V as well as lsof -p 1424 that should give us some more information about how nginx is installed and configured.

nexar

unread,
Apr 18, 2017, 11:15:17 AM4/18/17
to Phusion Passenger Discussions
Hope you are ready for this:  Here is the output from /usr/sbin/nginx -V
=========================
purvez@127:~$ /usr/sbin/nginx -V
nginx version: nginx/1.10.2
built with OpenSSL 1.0.2g-fips  1 Mar 2016 (running with OpenSSL 1.0.2g  1 Mar 2016)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_secure_link_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-threads --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/headers-more-nginx-module --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-auth-pam --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-cache-purge --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-dav-ext-module --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-development-kit --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-echo --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/ngx-fancyindex --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nchan --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-lua --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-upload-progress --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/nginx-upstream-fair --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/ngx_http_substitutions_filter_module --add-module=/tmp/buildd/nginx-1.10.2/debian/modules/passenger/src/nginx_module
purvez@127:~$ 
============================
AND here's the output from : lsof -p 1424
******************************************
purvez@127:~$ lsof -p 1424
COMMAND  PID USER   FD      TYPE DEVICE SIZE/OFF NODE NAME
nginx   1424 root  cwd   unknown                      /proc/1424/cwd (readlink: Permission denied)
nginx   1424 root  rtd   unknown                      /proc/1424/root (readlink: Permission denied)
nginx   1424 root  txt   unknown                      /proc/1424/exe (readlink: Permission denied)
nginx   1424 root NOFD                                /proc/1424/fd (opendir: Permission denied)
purvez@127:~$ 
*****************************************************************
This is getting a 'BIT' out of my depth now but I'll follow your lead.

Thx again.

Purvez

Camden Narzt

unread,
Apr 18, 2017, 11:17:29 AM4/18/17
to Phusion Passenger Discussions
Ok so the nginx -v command confirmed that it's a passenger enabled nginx, but it looks like the lsof command needs to be re-run with sudo as there should be much more output.

nexar

unread,
Apr 18, 2017, 12:17:45 PM4/18/17
to Phusion Passenger Discussions
Camden, you REALLY ARE a glutton for punishment!!  Here's the output from the sudo lsof -f 1424 command:
=========================

purvez@127:~$ sudo lsof -p 1424
sudo: unable to resolve host 127.0.1.1purvez-Aspire-5750: No such file or directory
[sudo] password for purvez: 
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF    NODE NAME
nginx   1424 root  cwd    DIR                8,5     4096       2 /
nginx   1424 root  rtd    DIR                8,5     4096       2 /
nginx   1424 root  txt    REG                8,5  3053128  695245 /usr/sbin/nginx
nginx   1424 root  DEL    REG                0,5            20172 /dev/zero
nginx   1424 root  mem    REG                8,5    26464  916009 /usr/lib/x86_64-linux-gnu/perl5/5.22/auto/nginx/nginx.so
nginx   1424 root  mem    REG                8,5    47600 1529148 /lib/x86_64-linux-gnu/libnss_files-2.23.so
nginx   1424 root  mem    REG                8,5    47648 1529042 /lib/x86_64-linux-gnu/libnss_nis-2.23.so
nginx   1424 root  mem    REG                8,5    93128 1529059 /lib/x86_64-linux-gnu/libnsl-2.23.so
nginx   1424 root  mem    REG                8,5    35688 1529155 /lib/x86_64-linux-gnu/libnss_compat-2.23.so
nginx   1424 root  mem    REG                8,5    22640  711347 /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
nginx   1424 root  mem    REG                8,5    14456  711364 /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
nginx   1424 root  mem    REG                8,5   137728  712089 /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
nginx   1424 root  mem    REG                8,5    58256  712114 /usr/lib/x86_64-linux-gnu/libjbig.so.0
nginx   1424 root  mem    REG                8,5  1285552  711513 /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
nginx   1424 root  mem    REG                8,5    80496 1529151 /lib/x86_64-linux-gnu/libgpg-error.so.0.17.0
nginx   1424 root  mem    REG                8,5 25913104  711859 /usr/lib/x86_64-linux-gnu/libicudata.so.55.1
nginx   1424 root  mem    REG                8,5   475496  712116 /usr/lib/x86_64-linux-gnu/libtiff.so.5.2.4
nginx   1424 root  mem    REG                8,5  2230840  713761 /usr/lib/x86_64-linux-gnu/libvpx.so.3.0.0
nginx   1424 root  mem    REG                8,5    72520  711991 /usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0
nginx   1424 root  mem    REG                8,5   273832  711509 /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.9.0
nginx   1424 root  mem    REG                8,5   694800  711699 /usr/lib/x86_64-linux-gnu/libfreetype.so.6.12.1
nginx   1424 root  mem    REG                8,5   149904 1529427 /lib/x86_64-linux-gnu/libpng12.so.0.54.0
nginx   1424 root  mem    REG                8,5   363264  714875 /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
nginx   1424 root  mem    REG                8,5   919168 1529011 /lib/x86_64-linux-gnu/libgcrypt.so.20.0.5
nginx   1424 root  mem    REG                8,5   137400 1529171 /lib/x86_64-linux-gnu/liblzma.so.5.0.0
nginx   1424 root  mem    REG                8,5  1636360  711855 /usr/lib/x86_64-linux-gnu/libicuuc.so.55.1
nginx   1424 root  mem    REG                8,5   117288 1529539 /lib/x86_64-linux-gnu/libaudit.so.1.0.0
nginx   1424 root  mem    REG                8,5    89696 1529072 /lib/x86_64-linux-gnu/libgcc_s.so.1
nginx   1424 root  mem    REG                8,5  1864888 1529075 /lib/x86_64-linux-gnu/libc-2.23.so
nginx   1424 root  mem    REG                8,5  1944024  715262 /usr/lib/x86_64-linux-gnu/libperl.so.5.22.1
nginx   1424 root  mem    REG                8,5   199264  714373 /usr/lib/x86_64-linux-gnu/libGeoIP.so.1.6.9
nginx   1424 root  mem    REG                8,5   422592  713506 /usr/lib/x86_64-linux-gnu/libgd.so.3.0.0
nginx   1424 root  mem    REG                8,5    83816  711980 /usr/lib/x86_64-linux-gnu/libexslt.so.0.8.17
nginx   1424 root  mem    REG                8,5   247952  711978 /usr/lib/x86_64-linux-gnu/libxslt.so.1.1.28
nginx   1424 root  mem    REG                8,5  1809656  711456 /usr/lib/x86_64-linux-gnu/libxml2.so.2.9.3
nginx   1424 root  mem    REG                8,5   104824 1529021 /lib/x86_64-linux-gnu/libz.so.1.2.8
nginx   1424 root  mem    REG                8,5  2361856 1529813 /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
nginx   1424 root  mem    REG                8,5   428384 1529817 /lib/x86_64-linux-gnu/libssl.so.1.0.0
nginx   1424 root  mem    REG                8,5   456632 1529577 /lib/x86_64-linux-gnu/libpcre.so.3.13.2
nginx   1424 root  mem    REG                8,5    31712 1529163 /lib/x86_64-linux-gnu/librt-2.23.so
nginx   1424 root  mem    REG                8,5  1566440  711853 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
nginx   1424 root  mem    REG                8,5   458024  711408 /usr/lib/x86_64-linux-gnu/libluajit-5.1.so.2.0.4
nginx   1424 root  mem    REG                8,5  1088952 1529044 /lib/x86_64-linux-gnu/libm-2.23.so
nginx   1424 root  mem    REG                8,5   166032 1529711 /lib/x86_64-linux-gnu/libexpat.so.1.6.0
nginx   1424 root  mem    REG                8,5    55904 1530261 /lib/x86_64-linux-gnu/libpam.so.0.83.1
nginx   1424 root  mem    REG                8,5    39224 1529184 /lib/x86_64-linux-gnu/libcrypt-2.23.so
nginx   1424 root  mem    REG                8,5   138696 1529169 /lib/x86_64-linux-gnu/libpthread-2.23.so
nginx   1424 root  mem    REG                8,5    14608 1529034 /lib/x86_64-linux-gnu/libdl-2.23.so
nginx   1424 root  mem    REG                8,5   162632 1529079 /lib/x86_64-linux-gnu/ld-2.23.so
nginx   1424 root  DEL    REG                0,5            20175 /dev/zero
nginx   1424 root    0u   CHR                1,3      0t0       6 /dev/null
nginx   1424 root    1u   CHR                1,3      0t0       6 /dev/null
nginx   1424 root    2w   REG                8,5       96 1308780 /var/log/nginx/error.log
nginx   1424 root    3u  unix 0xffff8800357c5c00      0t0   20246 type=STREAM
nginx   1424 root    4w   REG                8,5       96 1308780 /var/log/nginx/error.log
nginx   1424 root    6u  IPv4              20173      0t0     TCP *:http (LISTEN)
nginx   1424 root    7u  IPv6              20174      0t0     TCP *:http (LISTEN)
nginx   1424 root    8r  FIFO               0,10      0t0   20176 pipe
nginx   1424 root    9w  FIFO               0,10      0t0   20176 pipe
nginx   1424 root   10r  FIFO               0,10      0t0   20177 pipe
nginx   1424 root   11w  FIFO               0,10      0t0   20177 pipe
nginx   1424 root   12r  FIFO               0,10      0t0   20178 pipe
nginx   1424 root   13w  FIFO               0,10      0t0   20178 pipe
nginx   1424 root   14r  FIFO               0,10      0t0   20179 pipe
nginx   1424 root   15w  FIFO               0,10      0t0   20179 pipe
nginx   1424 root   16u  unix 0xffff8802419a8800      0t0   20180 type=STREAM
nginx   1424 root   17u  unix 0xffff8802419b1000      0t0   20247 type=STREAM
nginx   1424 root   18u  unix 0xffff880033534c00      0t0   20248 type=STREAM
nginx   1424 root   19u  unix 0xffff880033533000      0t0   20249 type=STREAM
nginx   1424 root   20u  unix 0xffff880239bbf800      0t0   20250 type=STREAM
nginx   1424 root   21u  unix 0xffff880239bbb400      0t0   20251 type=STREAM
nginx   1424 root   22u  unix 0xffff880239b20800      0t0   20252 type=STREAM
nginx   1424 root   23u  unix 0xffff880239b24800      0t0   20253 type=STREAM
nginx   1424 root   24w   REG                8,5      343 1308200 /var/log/nginx/access.log
purvez@127:~$ purvez@127:~$ lsof -p 1424
purvez@127:~$: command not found
purvez@127:~$ COMMAND  PID USER   FD      TYPE DEVICE SIZE/OFF NODE NAME
COMMAND: command not found
purvez@127:~$ nginx   1424 root  cwd   unknown                      /proc/1424/cwd (readlink: Permission denied)
bash: syntax error near unexpected token `('
purvez@127:~$ nginx   1424 root  rtd   unknown                      /proc/1424/root (readlink: Permission denied)
bash: syntax error near unexpected token `('
purvez@127:~$ nginx   1424 root  txt   unknown                      /proc/1424/exe (readlink: Permission denied)
bash: syntax error near unexpected token `('
purvez@127:~$ nginx   1424 root NOFD                                /proc/1424/fd (opendir: Permission denied)
bash: syntax error near unexpected token `('
purvez@127:~$ purvez@127:~$ 
purvez@127:~$: command not found
purvez@127:~$

===============================================

Camden Narzt

unread,
Apr 18, 2017, 12:22:16 PM4/18/17
to Phusion Passenger Discussions
Not really, I was looking for the config file so it's not hard to skim for. Since there's no config file there can you please run passenger start -a 127.0.0.1 -p 3001 --debug-nginx-config

That will dump the config that passenger generates for nginx, and we can look at it for why it might be binding port 80.

nexar

unread,
Apr 18, 2017, 12:33:49 PM4/18/17
to Phusion Passenger Discussions
Camden

Do I need to run this from the web directory or from my own 'home' directory?  Also what am I doing after running that?  Should I immediately run sudo lsof -p 1424?

Thanks

Purvez

Camden Narzt

unread,
Apr 18, 2017, 12:36:29 PM4/18/17
to Phusion Passenger Discussions
You'd ideally run it from the web directory. Afterwards just copy the output. It doesn't actually start any processes, just dumps the config that would be used if it weren't debugging.

nexar

unread,
Apr 18, 2017, 1:29:08 PM4/18/17
to Phusion Passenger Discussions
Thx Camden.  Here is the output:

===========================

purvez@127:~/www/gi$ passenger start -a 127.0.0.1 -p 3001 --debug-nginx-config
##########################################################################
#  Passenger Standalone is built on the same technology that powers
#  Passenger for Nginx, so any configuration option supported by Passenger
#  for Nginx can be applied to Passenger Standalone as well. You can do
#  this by direct editing the Nginx configuration template that is used by
#  Passenger Standalone.
#
#  This file is the original template. DO NOT EDIT THIS FILE DIRECTLY.
#  Instead, make a copy of this file and pass the `--nginx-config-template`
#  parameter to Passenger Standalone.
#
#  Learn more about using the Nginx configuration template at:
#
#  *** NOTE ***
#  If you customize the template file, make sure you keep an eye on the
#  original template file and merge any changes. New Phusion Passenger
#  features may require changes to the template file.
##############################################################

master_process on;
daemon on;
error_log '/home/purvez/www/gi/log/passenger.3001.log' ;
pid '/home/purvez/www/gi/tmp/pids/passenger.3001.pid';


worker_processes 1;
events {
    worker_connections 4096;
}

http {
    log_format debug '[$time_local] $msec  "$request" $status conn=$connection sent=$bytes_sent body_sent=$body_bytes_sent';
    include '/usr/share/passenger/mime.types';
    passenger_root '/usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini';
    passenger_abort_on_startup_error on;
    passenger_ctl cleanup_pidfiles L3RtcC9wYXNzZW5nZXItc3RhbmRhbG9uZS4xbDZiMWVnL3RlbXBfZGlyX3RvdWNoZXIucGlk;
    passenger_ctl integration_mode standalone;
    passenger_ctl standalone_engine nginx;
    passenger_user_switching off;
    passenger_log_level 3;


    ### BEGIN your own configuration options ###
    # This is a good place to put your own config
    # options. Note that your options must not
    # conflict with the ones Passenger already sets.
    # Learn more at:

    ### END your own configuration options ###

    default_type application/octet-stream;
    types_hash_max_size 2048;
    server_names_hash_bucket_size 64;
    client_max_body_size 1024m;
    access_log off;
    keepalive_timeout 60;
    underscores_in_headers on;
    gzip on;
    gzip_comp_level 3;
    gzip_min_length 150;
    gzip_proxied any;
    gzip_types text/plain text/css text/json text/javascript
        application/javascript application/x-javascript application/json
        application/rss+xml application/vnd.ms-fontobject application/x-font-ttf
        application/xml font/opentype image/svg+xml text/xml;

    

    
    server {
        server_name _;
        listen 127.0.0.1:3001;
        root '/home/purvez/www/gi/public';
        passenger_app_root '/home/purvez/www/gi';
        passenger_enabled on;
        passenger_app_env 'development';
        passenger_spawn_method 'smart';
        passenger_load_shell_envvars off;

        # Rails asset pipeline support.
        location ~ "^/assets/.+-([0-9a-f]{32}|[0-9a-f]{64})\..+" {
            error_page 490 = @static_asset;
            error_page 491 = @dynamic_request;
            recursive_error_pages on;
        
            if (-f $request_filename) {
                return 490;
            }
            if (!-f $request_filename) {
                return 491;
            }
        }
        location @static_asset {
            gzip_static on;
            expires max;
            add_header Cache-Control public;
            add_header ETag "";
        }
        location @dynamic_request {
            passenger_enabled on;
        }


        ### BEGIN your own configuration options ###
        # This is a good place to put your own config
        # options. Note that your options must not
        # conflict with the ones Passenger already sets.
        # Learn more at:

        ### END your own configuration options ###
    }
    passenger_pre_start http://127.0.0.1:3001/;
    

    
}
purvez@127:~/www/gi$ 

=================================================

Camden Narzt

unread,
Apr 18, 2017, 1:48:12 PM4/18/17
to Phusion Passenger Discussions
Ok so passenger standalone isn't telling nginx to bind to port 80.

What does sudo service status nginx report?

nexar

unread,
Apr 18, 2017, 2:01:48 PM4/18/17
to Phusion Passenger Discussions
Camden here' s the output for : sudo service status nginx.
======
purvez@127:~/www/gi$ sudo service status nginx 
sudo: unable to resolve host 127.0.1.1purvez-Aspire-5750: No such file or directory
[sudo] password for purvez: 
status: unrecognized service
purvez@127:~/www/gi$ 
=========
Please note that at the time that I ran it I did not have Passenger  Standalone started.

Thanks for your continued help here.

Purvez

nexar

unread,
Apr 18, 2017, 2:07:09 PM4/18/17
to Phusion Passenger Discussions

nexar

unread,
Apr 18, 2017, 2:09:34 PM4/18/17
to Phusion Passenger Discussions
Ok I've now started Passenger Standalone from the web directory and then ran the sudo service status nginx command again.  Here's the output from that:
============
purvez@127:~/www/gi$ sudo service status nginx
sudo: unable to resolve host 127.0.1.1purvez-Aspire-5750: No such file or directory
[sudo] password for purvez: 
status: unrecognized service
purvez@127:~/www/gi$ 
===========

I'm confused now!! Because Passenger Standalone IS RUNNING and I can access the website if I use localhost:3001.

Camden Narzt

unread,
Apr 18, 2017, 2:11:11 PM4/18/17
to Phusion Passenger Discussions
So there isn't a service registered to start nginx, and passenger standalone isn't telling nginx to bind port 80. Is the port still bound when passenger standalone isn't running? Also do you have a Passengerfile.json file?

nexar

unread,
Apr 18, 2017, 2:37:36 PM4/18/17
to Phusion Passenger Discussions
Hi Camden

Earlier when I ran netstat -plnt Passenger Standalone was not running but nginx was bound to port 80.  

Where should I look for Passengerfile.json please?

Purvez

Camden Narzt

unread,
Apr 18, 2017, 3:20:55 PM4/18/17
to Phusion Passenger Discussions
A Passengerfile.json would usually be kept in the directory where you start passenger standalone. I'm rather confused about how nginx is being started. Does running /usr/sbin/nginx -s stop shutdown nginx? and if not can you run ps -e | fgrep nginx to see if there's more than one nginx process (that way we can try the other process to look for the config it's using).

nexar

unread,
Apr 18, 2017, 4:14:58 PM4/18/17
to Phusion Passenger Discussions
Camden many thanks for your help today.  It's late in the UK now so I'm going to take up your suggestions first thing tomorrow morning .  Please stick with me.  Thanks

Purvez

nexar

unread,
Apr 19, 2017, 3:48:16 AM4/19/17
to Phusion Passenger Discussions
Hi Camden

I shutdown nginx using /usr/sbin/nginx -s stop.  That did shut nginx down because there was no other process showing up through ps -e |fgrep nginx.  I then attempted to start up Apache2 using sudo service apache2 start.....AND IT WORKED!!.  However although that gets apache2 back up and working I think I still need to understand what is starting up nginx at port 80 just to be sure that some other part of the system isn't breaking down.

I'm very grateful for your help here and without it I would not have been able to make much progress.  I'll wait to hear from you when convenient.

BTW I didn't find a Passengerfile.json file in the directory where I start Passenger Standalone.  What would you expect to have in that file?

Camden Narzt

unread,
Apr 19, 2017, 10:12:44 AM4/19/17
to Phusion Passenger Discussions
Well I was wondering if the file mentioned port 80, just in case passenger was what started that copy of nginx. Depending on the disk space used on your server, I'd recommend running a recursive grep from root looking for the string "listen 80" something like sudo fgrep -RH "listen 80;" / 2>/dev/null but depending on how full your disk is that could be very slow.

nexar

unread,
Apr 19, 2017, 1:51:55 PM4/19/17
to Phusion Passenger Discussions
Hi Camden

I'm sorry for not responding earlier but I've had some family issues to deal with today.  I'll run your suggestion :

 sudo fgrep -RH "listen 80;" / 2>/dev/null

tomorrow please and let you know the result.  I've got quite a few gigabytes of space on the disk.

nexar

unread,
Apr 20, 2017, 12:15:07 PM4/20/17
to Phusion Passenger Discussions
Hi Camden the :

sudo fgrep -RH "listen 80;" / 2>/dev/null

has been running for the best part of 8 hours as at the time of writing.  There has been no output from it at all.  My 'home' directory has a bunch of photos / music which will also get scanned.  Should I persevere or give up?  Is there some way of excluding the ~/ directory in the command.....or are you expecting something to pop up in my home directory?

Thanks for your continued help.

Purvez

Camden Narzt

unread,
Apr 20, 2017, 12:47:46 PM4/20/17
to Phusion Passenger Discussions
Honestly I have no idea where the config is located that the errant nginx was using, what's why I made the command search everything. Usually the nginx config is at /etc/nginx/nginx.conf but since your system was behaving oddly I'm not confident that will be the case, or even if there's a config there whether it was the one being used. You can't exclude directories this way but you can exclude files using the --exclude="" flag and putting a glob pattern in the quotes like --exclude="*.jpg"

nexar

unread,
Apr 20, 2017, 1:02:45 PM4/20/17
to Phusion Passenger Discussions
Hehehe!!! No problem neither my system nor I are going anywhere in a hurry.  I'm just going to let that command run it's course.  I'll report back in the next millennium. LOL!!

Speak to you tomorrow with 'some results' hopefully.

Thanks again

Purvez

nexar

unread,
Apr 21, 2017, 11:35:43 AM4/21/17
to Phusion Passenger Discussions
Camden, I was only joking about the next millennium.  It's now over 1.5 days that this is thing is running.  I'm going to kill the process and then permanently disable the nginx.  So far it's been off for nearly 2 days and nothing else has 'broken'.

I'm going to mark this as completed and would like to Thank You for your perseverance on this matter and all your help.

Purvez 
Reply all
Reply to author
Forward
0 new messages