nginx+ruby passenger starting but not working (+)

230 views
Skip to first unread message

AnLeAl AnLeAl

unread,
Apr 21, 2016, 7:37:30 AM4/21/16
to Phusion Passenger Discussions
Hi.

Please point me to right direction.

We have install debian 7 and follow this instruction:

Everything goes fine.

Main config have:
nginx.conf:
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/passenger_free_ruby;

Config of our app:
kb.conf:
server {
        listen 192.168.8.31:8080;
        server_name wiki;

root /var/www/railsapps/knowledge_base/public;

passenger_enabled on;
passenger_app_env development;
autoindex on;
}

After nginx stating we have in logs:
2016/04/21 14:26:26 [info] 2916#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:72
[ 2016-04-21 14:26:27.6904 2921/b6db1700 age/Wat/WatchdogMain.cpp:1301 ]: Starting Passenger watchdog...
[ 2016-04-21 14:26:27.7044 2924/b6dbc700 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2016-04-21 14:26:27.7048 2924/b6dbc700 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-04-21 14:26:27.7101 2924/b6dbc700 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 2924
[ 2016-04-21 14:26:27.7238 2930/b6e18700 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2016-04-21 14:26:27.7256 2930/b6e18700 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 2930

Looks like it starts.


passenger-memory-stats:

Version: 5.0.27
Date   : 2016-04-21 14:31:24 +0300
------------- Apache processes -------------
*** WARNING: The Apache executable cannot be found.
Please set the APXS2 environment variable to your 'apxs2' executable's filename, or set the HTTPD environment variable to your 'httpd' or 'apache2' executable's filename.


--------- Nginx processes ---------
PID   PPID  VMSize   Private  Name
-----------------------------------
2951  1     46.5 MB  0.2 MB   nginx: master process /usr/sbin/nginx
2952  2951  46.7 MB  0.4 MB   nginx: worker process
2953  2951  46.7 MB  0.3 MB   nginx: worker process
2955  2951  46.7 MB  0.3 MB   nginx: worker process
2956  2951  46.7 MB  0.3 MB   nginx: worker process
### Processes: 5
### Total private dirty RSS: 1.46 MB


---- Passenger processes ----
PID   VMSize   Private  Name
-----------------------------
2921  23.2 MB  0.6 MB   Passenger watchdog
2924  75.3 MB  1.4 MB   Passenger core
2930  32.3 MB  0.7 MB   Passenger ust-router
### Processes: 3
### Total private dirty RSS: 2.70 MB


Now we take folder structure of application knowledge_base from old server and copy to this new server setup.
After open 192.168.8.31:8080 we are only see directory structure, and if i click on any rb file it just downloads to me locally.

What am i doing wrong?
It looks like passenger not seeing that there was ruby app.

Hongli Lai

unread,
Apr 21, 2016, 7:53:51 AM4/21/16
to phusion-passenger
On Thu, Apr 21, 2016 at 1:37 PM, AnLeAl AnLeAl <ant...@gmail.com> wrote:
autoindex on;

Don't do this. With this option you are telling Nginx "don't use Passenger, show me a directory listing instead". The server is doing exactly what you told it to do.

AnLeAl AnLeAl

unread,
Apr 21, 2016, 7:57:13 AM4/21/16
to Phusion Passenger Discussions, hon...@phusion.nl
Removing this cause such logs:
2016/04/20 20:17:25 [error] 6271#0: *1 directory index of "/var/www/railsapps/knowledge_base/public/" is forbidden, client: 192.168.8.181, server: , request: "GET / HTTP/1.1", host: "192.168.8.31:8080"

And 403 error for me.

четверг, 21 апреля 2016 г., 14:53:51 UTC+3 пользователь Hongli Lai написал:

Hongli Lai

unread,
Apr 21, 2016, 8:01:25 AM4/21/16
to AnLeAl AnLeAl, Phusion Passenger Discussions
That is another error that also needs to be solved.

Nginx does not have permissions to access /var/www/railsapps/knowledge_base/public. You need to fix your filesystem permissions to allow Nginx to access /var/www/railsapps/knowledge_base/public, as well as all parent directories:

/var/www/railsapps/knowledge_base
/var/www/railsapps
/var/www
/var
--
Phusion B.V. | Web Application deployment, scaling, and monitoring solutions

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

AnLeAl AnLeAl

unread,
Apr 21, 2016, 8:05:37 AM4/21/16
to Phusion Passenger Discussions, ant...@gmail.com, hon...@phusion.nl
I don't think so, while autoindex was on , i was able to see content of public folder of the ruby app with rb file.
Also all was chowned by www-data:www-data.

четверг, 21 апреля 2016 г., 15:01:25 UTC+3 пользователь Hongli Lai написал:

Hongli Lai

unread,
Apr 21, 2016, 8:12:34 AM4/21/16
to AnLeAl AnLeAl, Phusion Passenger Discussions
Then maybe Passenger failed to autodetect your app? Does the file /var/www/railsapps/knowledge_base/config.ru exist?

AnLeAl AnLeAl

unread,
Apr 21, 2016, 8:19:39 AM4/21/16
to Phusion Passenger Discussions, ant...@gmail.com, hon...@phusion.nl
No, looks like i miss this:
In release notes. 
We have no such files on old server.



четверг, 21 апреля 2016 г., 15:12:34 UTC+3 пользователь Hongli Lai написал:

AnLeAl AnLeAl

unread,
Apr 21, 2016, 8:49:04 AM4/21/16
to Phusion Passenger Discussions, ant...@gmail.com, hon...@phusion.nl
Looks like config.ru was the key. We are now have much more intresting logs.

четверг, 21 апреля 2016 г., 15:19:39 UTC+3 пользователь AnLeAl AnLeAl написал:
Reply all
Reply to author
Forward
0 new messages