mylan atlani
mylan atlani

Reputation: 72

how to resolve puma not find by nginx?

I am currently experiencing a problem installing a Ruby on Rails application.

When I launch the application and go to the server address I get to the Nginx launch page, while my application is working and I have set up Puma and Nginx for that.

I change multiple time the sites-available conf of my app and also the puma.rb with no result.

I already generate the sites enabled file with command .

I don't understand why it doesn't work because on my app with thin it works

Puma.rb

threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count

port        ENV.fetch("PORT") { 3001 }

environment ENV.fetch("RAILS_ENV") { "production" }

bind  "unix:///home/ubuntu/happer-api2/tmp/puma/sockets/puma.sock"

plugin :tmp_restart

sites-available/happer-api

upstream app {
server unix:///home/ubuntu/happer-api2/tmp/puma/sockets/puma.sock;
}

server {
 listen 80;
 server_name localhost;
 root /home/ubuntu/happer-api2/public;

 try_files $uri/index.html $uri @app;

 location / {
     proxy_pass http://app;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header Host $http_host;
     proxy_redirect off;
 }

 error_page 500 502 503 504 /500.html;
 client_max_body_size 4G;
 keepalive_timeout 10;
}

Log stdout puma

=== puma startup: 2019-06-05 11:08:03 +0000 ===
[14768] * Starting control server on unix:///tmp/puma-status-1559732883521-14768
[14768] - Worker 0 (pid: 14810) booted, phase: 0

Log stderr puma

=== puma startup: 2019-06-04 11:01:28 +0000 ===
=== puma startup: 2019-06-04 11:01:51 +0000 ===
=== puma startup: 2019-06-05 11:08:03 +0000 ===

Upvotes: 0

Views: 1501

Answers (1)

arieljuod
arieljuod

Reputation: 15838

I'm not sure if this will help, but my config is a little different, change it to this:

upstream app {
  server unix:///home/ubuntu/happer-api2/tmp/puma/sockets/puma.sock;
}

server {
 listen 80;
 server_name localhost;
 root /home/ubuntu/happer-api2/public;

 location / {
     try_files $uri @app;
 }

 location @app {
     proxy_pass http://app;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header Host $http_host;
     proxy_redirect off;
 }

 error_page 500 502 503 504 /500.html;
 client_max_body_size 4G;
 keepalive_timeout 10;
}

Upvotes: 1

Related Questions