LINUX.ORG.RU

502 Bad Gateway nginx/1.10.3 (Ubuntu)?

 ,


0

1

Здравствуйте, пытаюсь развернуть проект на Rails и Angular используя pumu. Я получаю ошибку 502 в браузере при попытки открыть страницу по ip адресу, а по имени сервера выдает это (113) No route to host. В логах выдает вот такую ошибку:

2017/12/18 09:01:41 [error] 17215#17215: *8 connect() failed (113: No route to host) while connecting to upstream, client: 10.12.4.5, server: 10.12.4.245, request: "GET / HTTP/1.1", upstream: "http://10.12.4.245:80/", host: "10.12.4.242"
2017/12/18 09:01:42 [error] 17215#17215: *8 connect() failed (113: No route to host) while connecting to upstream, client: 10.12.4.5, server: 10.12.4.245, request: "GET /favicon.ico HTTP/1.1", upstream: "http://10.12.4.245:80/favicon.ico", host: "10.12.4.242", referrer: "http://10.12.4.242/"

Конфиг /etc/nginx/nginx.conf:

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
worker_connections 1024;
use epoll;
}

http {

access_log  /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

client_header_timeout 30;
client_body_timeout 30;
reset_timedout_connection on;

client_max_body_size 24m;
client_body_buffer_size 128k;

sendfile on;
tcp_nopush on;

keepalive_timeout  30;

gzip on;
gzip_disable "msie6";
gzip_proxied any;
gzip_min_length 1024;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript applicati$

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

/etc/nginx/sites-available/nginx.conf:

upstream puma {
  server unix:///var/www/phonebook-api/tmp/sockets/puma.sock;
}
server {
listen   80 default;
listen   [::]:80 default ipv6only=on;

server_name 10.12.4.245;
charset utf-8;
root /var/www/phonebook-api;

  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;

location / {
root phonebook-app/dist;
index index.html index.htm;
try_files $uri @app;
        gzip_static on;
        expires max;
        proxy_read_timeout 150;
        add_header Cache-Control public;
  }
  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://puma;
  }
   location @app {
     proxy_pass        http://10.12.4.245;
     proxy_set_header  X-Real-IP  $remote_addr;
     proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header  X-Forwarded-Proto http;
     proxy_set_header  Host $http_host  ;
     proxy_redirect    off;
     proxy_next_upstream error timeout invalid_header http_502;
    }

  client_max_body_size 50M;
  keepalive_timeout 10;
}