Not working for puma with nginx on Ubuntu 14.04.5 LTS
poc7667 opened this issue · comments
Poc commented
It's really strange that I'm using reverse nginx to pass the request to puma.
It won't work using foreman to run the upstart. (Although the puma is running well)
My service only working when I manually trigger the exact same run command for puma after boot.
I know this issue is so broader.
I checked the puma process using ps aux | grep puma
. Everything looks fine.
But it's always hang and doesn't take any request unless I kill the service and run it manually.
Nginx not working for the reverse proxy
upstream appwordsService {
server unix:///tmp/puma.appwords.sock;
}
server {
listen 443 ssl;
server_name appwords.co www.appwords.co;
....
location /api/v1 {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_connect_timeout 4s;
proxy_read_timeout 20s;
proxy_pass http://appwordsService/api/v1;
}
}
server {
listen 80;
server_name appwords.co www.appwords.co;
return 301 https://$server_name$request_uri;
}
Puma config
pidfile "/tmp/puma.appwords.pid"
bind "unix:///tmp/puma.appwords.sock"
stdout_redirect "/tmp/puma.stdout.appwords.log", "/tmp/puma.stderr.appwords.log", true
workers 1 # because my linode only has 2 CPU cores
threads 4, 8
#port 7617
rails_env = "production"
environment rails_env
activate_control_app
Procfile
web: /home/deployer123/.rbenv/shims/bundle exec puma -C config/puma.rb
Andrew Mason commented
@poc7667 is this still an issue?
Roman Klevtsov commented
I think no need to use foreman if you need to run just one process