I have an issue with my rails application running with passenger and nginx hosted in Ubuntu 12.04.
In the nginx.conf file below, my "example.com" (Regular HTML) and "redmine.example.com" (Rails app) are working perfectly, but my "crete.example.com" (Another Rails app) is showing "502 bad gateway". I have them both hosted in /var/data with the same permissions and ownerships, also tried different ports, I can't think of something else to try.
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server{
listen 80;
server_name example.com;
root /opt/nginx/html;
}
server{
server_name redmine.example.com;
root /var/data/redmine/public;
passenger_enabled on;
location ~ ^/<SUBURI>(/.*|$){
alias /var/data/redmine/public$1;
passenger_base_uri /redmine;
passenger_app_root /var/data/redmine;
passenger_document_root /var/data/redmine/public;
passenger_enabled on;}
}
server{
server_name crete.example.com;
root /var/data/crete/public;
passenger_enabled on;
location ~ ^/<SUBURI>(/.*|$){
alias /var/data/crete/public$1;
passenger_base_uri /crete;
passenger_app_root /var/data/crete;
passenger_document_root /var/data/crete/public;
passenger_enabled on;}
}
}
This are my Ruby and Rails versions:
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-linux]
Rails 4.1.0
My nginx error.log
2014/05/02 12:29:50 [error] 3343#0: *4 upstream prematurely closed connection while reading response header from upstream, client: xxx.xx.xx.xx, server: crete.example.com, request: "GET / HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.3
323/generation-0/request:", host: "crete.example.com"
Any other conf file you might need to solve this don't hesitate to ask.
Check out your sites-available and sites-enabled and see if your other rails app is included and configured properly. Also, check if these files are included in your nginx.conf
Related
I'm working with Rails + Passenger + Nginx
My project (Redmine) is in /var/www/tracker-continuity/current (and project in public).
I don't know why when I try to access to my serveur it's always a 404 Error page. We can see it in log
[ N 2018-06-05 14:23:20.6491 20067/T1 age/Cor/CoreMain.cpp:1236 ]: Starting Passenger core...
[ N 2018-06-05 14:23:20.6494 20067/T1 age/Cor/CoreMain.cpp:251 ]: Passenger core running in multi-application mode.
[ N 2018-06-05 14:23:20.6631 20067/T1 age/Cor/CoreMain.cpp:971 ]: Passenger core online, PID 20067
2018/06/05 14:23:31 [error] 20084#20084: *1 "/var/www/trackeur-continuity/current/public/index.html" is not found (2: No such file or directory), client: someIp, server: hideUrl, request: "GET / HTTP/1.1", host: "hideIp"
Here, part of my nginx.conf and my vhost conf. Extracted from a Nginx dump configuration. (Only Passenger parts)
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
user www-data;
worker_processes 4;
include /etc/nginx/modules-enabled/*.conf;
http {
...
}
# configuration file /etc/nginx/conf.d/mod-http-passenger.conf:
### Begin automatically installed Phusion Passenger config snippet ###
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/bin/passenger_free_ruby;
### End automatically installed Phusion Passenger config snippet ###
}
server {
listen 80;
server_name default_server ;
charset utf-8;
root /var/www/trackeur-continuity/current/public;
access_log /var/log/nginx/access.log timed_combined buffer=16k;
error_log /var/log/nginx/error.log;
passenger_enabled on;
rails_env development;
client_max_body_size 110m;
}
Got it !
tracker-continuity not trackeur-continuity
I have an nginx server with passenger that I am trying to run a ruby on rails app. I am using rbenv and am deploying using capistrano.
I keep getting an error message that is as follows:
directory index of "[/srv/[directory]]" is forbidden, client: [my client ip], server: [my domain], request: "GET / HTTP/1.1", host: "[my domain]"
My nginx config for the site:
server {
listen 80;
server_name [my domain];
passenger_enabled on;
rails_env production;
root /srv/[my app name]/current/public;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
passenger_enabled on;
}
location / {
passenger_enabled on;
}
}
And my config for passenger in my nginx.conf file is as follows:
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
On a EC2 with ubuntu 14.04 with nginx/passenger/rails came with this log on nginx:
App 31063 stderr: * ERROR *: Cannot execute /usr/local/lib/ruby:
Permission denied (13)
App 31065 stderr: /etc/profile.d/rbenv.sh: line 3: rbenv: command not
found nginx conf is:
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
passenger_root /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.0.18;
passenger_ruby /usr/local/lib/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name teste.com;
root /home/ubuntu/teste/current/public;
passenger_enabled on;
rails_env production;
access_log logs/access.log;
location ~ ^/(assets)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
}
someone cloud give some light? thank's
Execute in Terminal
sudo chmod o+x "/root"
Resolve this problem!
* ERROR *: Cannot execute /root/.rbenv/versions/2.2.3/bin/ruby Phusion Passenger Permission denied (13)
Phusion Passenger nginx centos
http://oki2a24.com/2014/02/08/try-to-install-ruby-and-redmine/
passenger_ruby should point to the ruby command itself. Yours appears to point to a directory /usr/local/lib/ruby/ (based partly on the passenger_root path).
https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ruby
Try changing passenger_ruby to /usr/bin/ruby , or whatever your path is. "which ruby" would give you the path, if it's in your PATH environment variable.
I'm hosing a rails application on digital ocean. Its working perfectly. I would like to host a Sinatra application on the same VPS. I have setup the nameservers and DNS.
My opt/nginx/conf/nginx.conf is:
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /home/deploy/.rvm/gems/ruby-2.0.0-p0/gems/passenger-4.0.0.rc6;
passenger_ruby /home/deploy/.rvm/wrappers/ruby-2.0.0-p0/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name domain1.com;
charset utf-8;
root /home/deploy/apps/domain1/current/public;
passenger_enabled on;
rails_spawn_method smart;
rails_env production;
}
server {
listen 80;
server_name domain2.com www.domain2.com;
charset utf-8;
root /home/deploy/apps/domain2-path/public;
passenger_enabled on;
rails_spawn_method smart;
}
}
Now when I go domain2.com it loads the application of domain1.com, what am I doing wrong.
PS: Domain1.com is rails applicion and Domain2.com is sinatra application.
You cannot do it only by defining another DNS address.
You should run the other app on different URL.
Then do something like this:
upstream rails {
server 127.0.0.1:8000;
}
upstream sinatra {
server 127.0.0.1:7000;
}
server {
location /rails {
proxy_pass http://rails;
}
location /sinatra {
proxy_pass http://sinatra;
}
}
I have:
Ubuntu 12.04 LTS
ruby-1.9.3-p194
Rails 3.2.7
I am trying to get access to my Rails application through Nginx + Passenger.
/opt/nginx/conf/nginx.conf file is:
user test;
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /home/test/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14;
passenger_ruby /home/test/.rvm/wrappers/ruby-1.9.3-p194/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 10.11.11.178;
root /efiling/public;
passenger_enabled on;
location / {
root html;
index index.html index.htm;
}
....
When I enter a link 10.11.11.178 I get Welcome to nginx!
But I am expecting to get Rails app default page.
What is wrong?
Thanks in advance.
#Jashwant. First, I removed line as was mentioned by #Brandon. Second, I removed index.html file from my_app\public folder.
Try removing the following from the config:
location / {
root html;
index index.html index.htm;
}