I have a rails app on a production server with Passenger and Nginx (with the Passenger module) installed. However, when I go to run rvmsudo passenger-status, it show that 0 processes are running.
For reference, here is my nginx.conf:
#user www-data;
user root;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
#passenger_ruby /usr/bin/ruby;
passenger_ruby /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
The /etc/nginx/sites-enabled/ directory contains the relevant Server information.
Here is the output of ps aux | grep nginx:
root 11417 0.0 0.0 42412 1076 ? Ss 13:13 0:00 nginx: master process /opt/nginx/sbin/nginx
nobody 11418 0.0 0.0 42852 1844 ? S 13:13 0:00 nginx: worker process
When I go to the site via my web browser, I get a "Welcome to nginx!" landing page.
I'm a total newbie at this stuff so there might be something dumb simple going on but I just need to get this started up. Any help would be greatly appreciated.
Edit:
Output of rvmsudo passenger-status:
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
to avoid the warning, put it in shell initialization file to make it persistent.
Version : 4.0.42
Date : 2014-12-22 14:04:17 -0500
Instance: 11417
----------- General information -----------
Max pool size : 6
Processes : 0
Requests in top-level queue : 0
----------- Application groups -----------
Output of rvmsudo passenger-memory-stats:
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:
export rvmsudo_secure_path=1
to avoid the warning, put it in shell initialization file to make it persistent.
In case there is no `secure_path` in `/etc/sudoers`. Run:
export rvmsudo_secure_path=0
to avoid the warning, put it in shell initialization file to make it persistent.
Version: 4.0.42
Date : 2014-12-22 14:07:57 -0500
------------- 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
-------------------------------------
11417 1 41.4 MB 0.1 MB nginx: master process /opt/nginx/sbin/nginx
11418 11417 41.8 MB 0.6 MB nginx: worker process
### Processes: 2
### Total private dirty RSS: 0.71 MB
----- Passenger processes -----
PID VMSize Private Name
-------------------------------
11399 218.3 MB 0.3 MB PassengerWatchdog
11402 491.5 MB 0.4 MB PassengerHelperAgent
11408 232.9 MB 1.1 MB PassengerLoggingAgent
### Processes: 3
### Total private dirty RSS: 1.74 MB
Phusion Passenger author here. I'm 99% sure this is just an Nginx configuration error.
First of all, Phusion Passenger starts your app at the first request, so it's normal that you see '0 processes' -- unless explicitly configured otherwise with passenger_pre_start.
The clue is the fact that you see "Welcome to nginx" when you try to visit your site. In 99% of the cases, this means that you configured your virtual host wrong. Since you redacted your config file, I cannot tell you what exactly is wrong, but it indicates that Nginx is not associating your request with the virtual host block that you intended it to associate with. If you post your unredacted config file and the URL you're accessing with, I can tell you more. But otherwise, I can only tell you to study how Nginx's server name matching works.
#tagCincy: There is one file under /etc/nginx/sites-enabled/ and it looks like this:
server {
listen 443;
server_name REDACTED;
ssl on;
ssl_certificate REDACTED;
ssl_certificate_key REDACTED;
#auth_basic "REDACTED";
#auth_basic_user_file REDACTED;
client_max_body_size 250m;
client_body_buffer_size 128k;
access_log REDACTED;
error_log REDACTED;
root REDACTED;
passenger_enabled on;
rack_env production;
location ~ ^/assets/ {
add_header Cache-Control public;
add_header ETag "";
expires 1y;
break;
}
# disable site via capistrano (cap deploy:web:disable)
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
}
server {
listen 80;
server_name REDACTED;
client_max_body_size 250m;
client_body_buffer_size 128k;
access_log REDACTED;
error_log REDACTED;
rewrite ^ https://www.REDACTED.com$request_uri? break;
}
Related
I upgrade my ruby version to 2.6.5. I deployed it to my server using capistrano.
But my nginx logs say this:
App 9470 output: /bin/sh: 1: exec: /home/deploy/.rvm/gems/ruby-2.3.1/wrappers/ruby: not found
[ E 2022-01-27 12:34:23.7336 9450/Tc age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /home/deploy/taddar/current: The application process exited prematurely.
Error ID: d1f83ca0
Error details saved to: /tmp/passenger-error-0KwZUf.html
[ E 2022-01-27 12:34:23.7393 9450/T9 age/Cor/Con/CheckoutSession.cpp:276 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is d1f83ca0. Please see earlier logs for details about the error.
When I run ruby -v I get 2.6.5, yet above you can see its looking for 2.3.1:
ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
Any ideas on how to fix this?
In my deploy.rb I set the ruby version.
set :rvm_ruby_version, '2.6.5'
My nginx.config looks like:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
passenger_ruby /usr/bin/ruby2.6.5;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
underscores_in_headers on;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
include /etc/nginx/passenger.conf;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Bingo got it working. Thanks to #razvans and #engineersmnky for pointing me in the right direction.
Yes I had references to passenger_ruby but it was in the wrong place. I had to go to /etc/nginx/sites-available and add passenger_ruby /path/to/ruby
To find out what the /path/to/ruby is use passenger-config about ruby-command and use the value at Command.
passenger-config about ruby-command
passenger-config was invoked through the following Ruby interpreter:
Command: /home/deploy/.rvm/gems/ruby-2.6.5/wrappers/ruby
So mine was
server {
....
passenger_ruby /home/deploy/.rvm/gems/ruby-2.6.5/wrappers/ruby
You might want to know any other references you have to ruby so they don't conflict with each other. A useful command is: grep -rnw 'path' -e 'passenger_ruby'
This doc helped me a lot https://www.phusionpassenger.com/library/deploy/nginx/deploy/ruby/#determine_ruby_command
I tried the solution of a similar question and many other on stackoverflow but none of them seem to solve this issue. The default niginx "Welcome" page was running even when I configured /etc/nginx/passenger.conf and /etc/nginx/passenger.conf. It was after I configured the /etc/nginx/sites-enabled/default, by changing the default path to my rails app, I started getting 403 forbidden error.
This is the error log.
2017/02/20 06:05:17 [error] 27311#27311: *2 directory index of "/home/deploy/Blog/current/public/" is forbidden, client: 111.93.247.206, server: mydomain.com, request: "GET / HTTP/1.1", host: "35.154.168.57"
My nginx files are as follows.
/etc/nginx/nginx.conf
user deploy;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
# include /etc/nginx/passenger.conf;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
/etc/nginx/passenger.conf
passenger_ruby /home/deploy/.rvm/wrappers/ruby-2.3.1/ruby;
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
#passenger_ruby /usr/bin/passenger_free_ruby;
/etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name mydomain.com;
passenger_enabled on;
rails_env production;
root /home/deploy/Blog/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
The permissions are:
lrwxrwxrwx 1 root root 34 Feb 20 06:00 /etc/nginx/sites-enabled/default
-rw-r--r-- 1 root root 179 Feb 20 06:35 /etc/nginx/passenger.conf
-rw-r--r-- 1 root root 1608 Feb 20 06:34 /etc/nginx/nginx.conf
Please can somebody tell what am I doing wrong or what have I not done?
Thank You
Follow these steps:
Backup /home/deploy/Blog/current/public
chown -R <nginxuser>:<nginxuser> /home/deploy/Blog/current/public
nginxuser: the user that runs nginx, its probably one of the following: nginx, www-data, root.
Not sure what exactly you missing. Please align yourself with my setup on https://www.wiki11.com.
Your issue is coming because nginx is trying to search for index.html file into /home/deploy/apps/mll/current/public which is not present there.
In order to fix, you will need to add passenger with your nginx.
Instructions to follow.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
Add Passenger APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
Install passenger and nginx
sudo apt-get install -y nginx-extras passenger
Now start nginx webserver.
sudo service nginx start
Next, we need to update the Nginx configuration to point Passenger to the version of Ruby that we're using.
sudo vim /etc/nginx/nginx.conf
And add or uncomment
include /etc/nginx/passenger.conf;
Save and close nginx.conf. Then open /etc/nginx/passenger.conf
sudo vim /etc/nginx/passenger.conf
If you are using .rbenv, then
passenger_ruby /home/deploy/.rbenv/shims/ruby;
Or if you are using rvm, then
passenger_ruby /home/deploy/.rvm/wrappers/ruby-2.5.0/ruby;
Or if you are using system ruby, then
passenger_ruby /usr/bin/ruby;
Next, restart nginx server
sudo service nginx restart
Add passenger_enabled on; into your site-enabled/centers or site-enabled/nodeapp file.
server {
listen 80;
listen [::]:80;
root /home/deploy/apps/mll/current/public;
index index.html index.htm;
server_name myrailssite.com;
passenger_enabled on;
location / {
try_files $uri $uri/ =404;
}
}
Restart nginx server again, sudo service nginx restart. Hopefully it should work.
For more details, follow,
https://www.phusionpassenger.com/library/install/nginx/install/oss/xenial/
I am trying to get a passenger + nginx instance running. Passenger has been successfully installed however, when going to to http://lakemagazine.northcentralus.cloudapp.azure.com/ we are receiving a time out error. So, I looked at nginx:
garrett#lakemag:~$ sudo nginx -t
nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:65
nginx: configuration file /etc/nginx/nginx.conf test failed
Thus, nginx is not running, which I assume is my problem.
Here is my nginx.conf file:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml applic$
##
# Virtual Host Configs
##
#include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
server {
listen 80;
server name http://lakemagazine.northcentralus.cloudapp.azure.com/;
root /lakemag/public;
passenger_enabled on;
passenger_ruby /home/garrett/.rvm/gems/ruby-2.3.0/wrappers/ruby;
}
}
Line 65 is where my server {} block starts. I am at a loss to my problem - all of the blocks seem to be defined appropriately to me. am I missing something?
*EDIT:
garrett#lakemag:~$ sudo nginx -t
[sudo] password for garrett:
nginx: [warn] server name "http://lakemagazine.northcentralus.cloudapp.azure.com/" has suspicious symbols in /etc/nginx/nginx.conf:65
nginx: [emerg] unknown directive "passenger_enabled" in /etc/nginx/nginx.conf:69
nginx: configuration file /etc/nginx/nginx.conf test failed
After Jorge's solution I am now receiving the above errors.
Where says:
server name http://lakemagazine.northcentralus.cloudapp.azure.com/
should say:
server_name http://lakemagazine.northcentralus.cloudapp.azure.com/
server is a directive to define a server block and to identify what server is you should write a server_name directive into it
http://nginx.org/en/docs/http/server_names.html
To check config file syntax use:
nginx -t
I have mentioned this in my /etc/nginx/nginx.conf file
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# Phusion Passenger config
##
# Uncomment it if you installed passenger or passenger-enterprise
##
passenger_root /home/dinshaw/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.56;
passenger_ruby /home/dinshaw/.rvm/gems/ruby-2.1.5/wrappers/ruby;
client_max_body_size 2M;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
rails_env development;
listen 80;
server_name localhost;
root /home/dinshaw/projects/freeway/freeway-sdk-portal/public;
access_log /home/dinshaw/projects/freeway/freeway-sdk-portal/log/nginx_access.log;
error_log /home/dinshaw/projects/freeway/freeway-sdk-portal/log/nginx_error.log;
passenger_enabled on;
}
}
# mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
# }
And there is no effect after this I had this outside the server i.e like this also :
passenger_root /home/dinshaw/.rvm/gems/ruby-2.1.5/gems/passenger-4.0.56;
passenger_ruby /home/dinshaw/.rvm/gems/ruby-2.1.5/wrappers/ruby;
server {
rails_env development;
client_max_body_size 2M;
listen 80;
server_name localhost;
root /home/dinshaw/projects/myCode/public;
access_log /home/dinshaw/projects/myCode/log/nginx_access.log;
error_log /home/dinshaw/projects/myCode/log/nginx_error.log;
passenger_enabled on;
}
But this is also not working If am uploading more than this also it is not giving error. My
nginx version: nginx/1.6.3
Please guide me its about more than 2 days am working on it and not getting what to do.
What you have done by putting the client_max_body_size inside both your http {} and server {} brackets is micro-define your client_max_body_size.
NGINX works by basically nesting control settings, the outer most shell being http {} -> server {} -> location {}. So, what this means is that if you set something in http {}, it is applied to server {} and location {}. But if you set something in server {}, it will only apply to that server {} and not to http {}.
note: always, whenever you make some changes to your nginx.conf file, you must restart your nginx server (as #ihsan suggested above):
sudo service nginx restart
What you've done here is a good try, but you've defined the same thing twice so it shouldn't make much of a difference if it didn't work the first time.
I have run into this issue many times, and aside from changing your nginx.conf file to allow your max size to be 2M, you also need to change your php.ini file to allow you a certain size to upload (2M I guess?).
Inside your php.ini file you will find something that looks like:
upload_max_filesize = 10M
post_max_size = 10M
You must also change these limits to match your expected upload file size. How big you go is your choice, but remember, the bigger you set this limit, the more opportunity you are giving spammers or server bullies to upload big files to your server, thus taking up precious space and bandwidth.
Finally, if you monitor your NGINX error.log, you should be able to see the exact process that's restricting your upload. You enable your error.log within your http {} or server {} brackets, as:
error_log /var/log/nginx/error.log warn;
Reminder though, that setting your log level to warn will make very big files (especially if you have lots of virtual servers running), so it's suggested to only keep it like this when you're troubleshooting perhaps, and then turning it back to higher errors only.
For more information on how to monitor NGINX errors, read here: https://www.nginx.com/resources/admin-guide/logging-and-monitoring/
Hope this helps!
This question has been asked too many times. I've spent hours going through all the posts on stackoverflow and so far no luck. Always get 403 Forbidden when trying to access my rails app. Testing this with an empty newly generated app.
All files in /var/www are owned by www-data. I've set permissions to 755 on the full path to the code. When I add index.html to the public directory it gets displayed, but I can't get the app to run.
Here is the configuration in sites enabled
server {
listen 80;
root /var/www/default/public;
server_name s.dev
passenger_enabled on;
rails_env development;
}
nginx.conf
user www-data;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_vary off;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/rss+xml application/atom+xml text/javascript application/javascript application/json text/mathml;
gzip_min_length 1000;
gzip_disable "MSIE [1-6]\.";
server_names_hash_bucket_size 64;
types_hash_max_size 2048;
types_hash_bucket_size 64;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
passenger.conf
passenger_root /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.17;
passenger_ruby /usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby;
passenger_max_pool_size 6;
passenger_spawn_method smart-lv2;
passenger_use_global_queue on;
passenger_buffer_response on;
passenger_min_instances 1;
passenger_max_instances_per_app 0;
passenger_pool_idle_time 300;
passenger_max_requests 0;
Any suggestions as to what I can try will be much appreciated!
Thank you
More information:
passenger-config --root
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.17
which ruby
/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
This is the error
2013/09/11 16:03:00 [error] 30400#0: *3 directory index of "/var/www/default/public/" is forbidden, client: 145.33.44.33, server: s.dev, request: "GET / HTTP/1.1", host: "s.dev"
passenger-memory-stats
Version: 4.0.17
Date : 2013-09-11 16:24:16 -0400
------- Apache processes --------
### Processes: 0
### Total private dirty RSS: 0.00 MB
---------- Nginx processes ----------
PID PPID VMSize Private Name
-------------------------------------
32226 1 38.8 MB 0.2 MB nginx: master process /opt/nginx-1.5.4/sbin/nginx
32227 32226 39.2 MB 0.6 MB nginx: worker process
32228 32226 39.2 MB 0.5 MB nginx: worker process
### Processes: 3
### Total private dirty RSS: 1.25 MB
----- Passenger processes -----
PID VMSize Private Name
-------------------------------
32200 216.2 MB 0.3 MB PassengerWatchdog
32205 489.6 MB 0.3 MB PassengerHelperAgent
32220 223.6 MB 0.8 MB PassengerLoggingAgent
### Processes: 3
### Total private dirty RSS: 1.40 MB
I am also able to run app successfully when running "passenger start"
So it started to work. The weird part is that I can't really tell what caused it to start working. I've made a few mistakes along the way that I have fixed. One was adding basic auth incorrectly to the site configuration:
server {
listen 80;
root /var/www/default/public;
server_name s.dev;
location / {
auth_basic "Restricted";
auth_basic_user_file /var/www/default/.htpasswd;
passenger_enabled on; <------ did not remember to add this
}
passenger_enabled on;
rails_env development;
}
Another thing was to add a user to nginx.conf and make this user the owner of /var/www/default - although I am pretty sure that this was one of the things I've tried when things were not working
Thank you everyone for helping out
maybe it is because of the passenger_spawn_method smart-lv2?
according to http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_max_instances_per_app_lt_integer_gt :
As of Phusion Passenger 4.0, conservative spawning was renamed to direct and smart-lv2 was renamed to smart. The old smart spawning has been removed in favor of the new version.
And as:
The default value is smart.
try just removing it.