N
N
nyxendxm2017-12-15 09:17:17
Nginx
nyxendxm, 2017-12-15 09:17:17

(113) No route to host?

Displays an error in the log "No route to place"
error.log:

2017/12/15 10:49:12 [error] 377#377: *6 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/"

Can anyone please help me, what am I doing wrong?
nginx.conf:
upstream puma {
  server unix:///home/solovievga/phonebook-api/tmp/sockets/puma.sock;
}
server {
listen   80 default;
listen   [::]:80 default ipv6only=on;

server_name 10.12.4.245;
root /home/solovievga/phonebook-api;

location / {
root /home/solovievga/phonebook-api/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;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Grigoriev, 2017-12-15
@Sleuthhound

113: No route to host

Nginx can't find a route to the backend server.
1. The entry must be of the form
see the documentation
2. Nginx (the user with whose rights it works, usually nginx or www-data) must have rights 0660 on the socket /home/solovievga/phonebook-api/tmp/sockets/puma.sock
listen   80 default;
server_name 10.12.4.245;
и
ниже
location / {
...
        try_files $uri @app;
...
}
и
   location @app {
     proxy_pass        http://10.12.4.245;

Are you sure you want to proxy to yourself?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question