I'm putting together my first ROR app on NginX and Passenger. I'm following tutorials all over the web and I'm getting the following errors when I try to go to my home page.
I created a controller home_controller.rb using the command line. I also created the views at the command line which made a default ERB file.
The nginx service is running and I start passenger manually via "passenger start". I can see passenger accepting the incoming HTTP requests as in the following errors. What's strange though is that it's looking in the public folder of my ruby app for home/index. I used "rails generate [controller/view] foo" which writes files outside of public.
My nginx config is configured to point to the public folder of my ROR project.
I'm using ROR 2.0.0, Phusion Passenger 4.0.29, and nginx 1.1.19.
Am I missing something in Passenger to tell it where the controllers/views/etc. are?
mj
2013/12/13 15:20:12 [error] 18305#0: *4 "/usr/development/sandbox/app/public/index.html"
is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "HEAD /
HTTP/1.1", host: "0.0.0.0"
2013/12/13 15:20:13 [error] 18305#0: *5 "/usr/development/sandbox/app/public/index.html"
is not found (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET
HTTP/1.1", host: "localhost:3000"
2013/12/13 15:20:18 [error] 18305#0: *5 open()
"/usr/development/sandbox/app/public/home/index" failed (2: No such file or directory),
client: 127.0.0.1, server: _, request: "GET /home/index HTTP/1.1", host: "localhost:3000"
2013/12/13 15:27:11 [error] 18305#0: *13 open()
"/usr/development/sandbox/app/public/home/index" failed (2: No such file or directory),
client: 127.0.0.1, server: _, request: "GET /home/index HTTP/1.1", host: "localhost:3000"
edit 0 - if I use "rails server", everything seems to work fine /edit 0
You are using Phusion Passenger in the wrong way.
Phusion Passenger provides 3 modes: a standalone mode (one that runs as a standalone web server), an Nginx integration mode, and an Apache integration mode. By running passenger start, you are using its standalone mode.
You also have Nginx running. And from your logs, it looks like you are accessing Nginx. But that doesn't do anything. Passenger is running standalone and is not running inside Nginx.
In a diagram:
Nginx <--------------------- [Your request]
(Not integrated with Passenger,
so doesn't know what to do with
your request)
Passenger Standalone
(waiting for your request,
but you never sent one
to it)
So here's how it looks like if you use rails server:
Nginx
(not receiving any
requests from you)
rails server <--------------- [Your request]
What you actually want is to access Passenger Standalone, which -- just like rails server would -- listens on port 3000. In fact, Passenger Standalone told you during startup that it's listening on port 3000.
Nginx
(not receiving any
requests from you;
so you may as well
disable it)
Passenger Standalone <--------------- [Your request]
Related
working on an existing project that was working on my Win 10 machine. and continues to work on a Colleagues mac
calling
lando start -vvv
launches docker, starts the containers
but where it check the urls for the site lando prints checking to see if https://localhost:52144 is ready. diversiview 14:53:11 DEBUG ==> scan failed for https://localhost:52144 code=undefined, message=Request failed with status code 502, status=502, server=nginx, date=Wed, 09 Nov 2022 03:53:11 GMT, content-type=text/html, content-length=150, connection=close diversiview 14:53:11 DEBUG ==> Response for https://localhost:52144, returned http code we should retry for. Setting to bad
and the nginx docker container prints 2022/11/09 03:52:58 [error] 238#0: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.2, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://172.20.0.6:9000", host: "diversiview.lndo.site"
tried on a new computer and the same problem meaning something has changed in the project but
ive tride backups of the project from when it was working and they dont anymore.
tried with docker using WSL and without.
I dont know enough about lando or docker to know what other info to provide
re installed all programs relevent
I am developing a Ruby on Rails application and meanwhile I am currently using a Wordpress blog that serves as a landing page.
I am using Ruby (2.2.4) on Rails (4.2.6) on an AWS EC2 instance. I'm also using nginx, apache and puma.
The problem I ran into was the following:
* Restarting nginx nginx [fail]
And the logs are the following:
2016/10/25 23:54:53 [emerg] 24676#0: duplicate upstream "php" in /etc/nginx/sites-enabled/defaultsave:148
I have these two upstream configurations that read as follows (/etc/nginx/sites-enabled/default):
upstream puma {
server unix:///home/deploy/apps/APPLICATION_NAME/shared/tmp/sockets/APPLICATION_NAME-puma.sock;
}
and
upstream php {
server unix:/var/run/php5-fpm.sock;
}
Can I have two upstream configurations? How can I solve this issue?
I also tried commenting one of the upstreams and the logs read as follows:
2016/10/26 00:14:22 [emerg] 25249#0: duplicate listen options for 0.0.0.0:80 in /etc/nginx/sites-enabled/default.save:154
Can I listen to the same port and proxy to the correct server having into account the server_name?
Didn't deployed Rails application in AWS OpsWorks. Totally confused how to do this! Could anyone tell me how many instance required to deploy a RoR application?
I have created "Rails App Server" instance and it's looks fine. And here I used nginx and Unicorn as Rails Stack.
After that I've added a application from a git repo. Then deployed that application. And logs showing it's deployed successfully.
But in Public IP it's showing 404 Not Found Error - nginx!
Any help would be appreciable.
I had this issue, and it turned out that the default virtual host /etc/nginx/sites-enabled/000-default symbolic link was not getting removed during deployment.
The 404 was actually nginx looking for a public root of whatever was in the default virtual host, as seen in /var/logs/nginx/error.log
2015/12/23 21:46:05 [error] 3839#0: *15 "/var/www/nginx-default/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: rails-app1, request: "GET / HTTP/1.1", host: "localhost"
Worse, it comes back after every OpsWorks deployment. Removing that link fixed the problem for me.
To make the fix sustainable and automated, I added a custom recipe to the Deploy lifecycle event for the Rails App Server layer, called custom-cookbook::delete-default-site. The recipe looks like this:
file '/etc/nginx/sites-enabled/000-default' do
action :delete
end
service 'nginx' do
action :reload
end
Check process list for unicorn and its log files. Deployment doesn't fail for some reason if unicorn master process doesn't start.
We have Ruby on Rails application, that is running on VPS. This night the nginx went down and responded with "502 Bad Gateway". Nginx error log contained lots of folowing messages:
2013/10/02 00:01:47 [error] 1136#0: *1 connect() to
unix:/app_directory/shared/sockets/unicorn.sock failed (111:
Connection refused) while connecting to upstream, client:
5.10.83.46, server: www.website.com, request: "GET /resource/206 HTTP/1.1", upstream:
"http://unix:/app_directory/shared/sockets/unicorn.sock:/resource/206",
host: "www.website.com"
These errors started suddenly, because previous error messages was 5 days earlier.
So the problem was in unicorn server. Then i opened unicorn error log and found there just some info messages, which doesn't connected with a problem. Production log was useless too.
I tried to restart server via service nginx restart, but it didn't help. Also there were not some pending processes of unicorn.
The problem was solved when i redeploy the application. And it is strange, because i deployed the same version of application 10 hours before server went down.
I'm looking for any suggestions how to prevent such 'magic' cases in future. Appreciate any help you can provide!
Looks like your unicorn server wasn't running when nginx tried to access it.
This can be caused by VPS restart, some exception in unicorn process, or killing of unicorn process due to low free memory. (IMHO VPS restart is the most possible reason)
Check unicorn by
ps aux | grep unicorn
Also you can check server uptime with
uptime
Then you can:
add script that would start unicorn on VPS boot
add it as service
run some monitoring process (like monit)
I'm trying to deploy a Ruby on Rails app to my VPS for the first time. I'm following this guide.
Everything seems to be working on my local machine.
I'm currently at the "Testing the VPS" part of the guide.
On my VPS, static pages that I have in my public folder work fine. However, I'm receiving an error message when I try to access a dynamic page.
When trying to go to http://server-ip-address.com/users (as specified by the guide) I am encountering this error from nginx:
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
If you are the system administrator of this resource then you should check the error log for details.
The logs at /opt/nginx/logs/error.log state:
2013/07/08 20:47:32 [crit] 17760#0: *151 connect() to /tmp/passenger.1.0.12435/generation- 0/request failed (2: No such file or directory) while connecting to upstream, client: client- ip-address, server: server-ip-address, request: "GET /user HTTP/1.1", upstream: "passenger:/tmp/passenger.1.0.12435/generation-0/request:", host: "server-ip-address"
I'm not sure how to fix this. Any help?
Thank you!
This is a bug in 4.0.7. Fixed in 4.0.8, which was released an hour ago.