E
E
Evgeny Motovilov2017-02-09 15:22:01
Nginx
Evgeny Motovilov, 2017-02-09 15:22:01

Why can't nginx connect to apach?

Here is the error log:

2017/02/09 15:15:42 [error] 16231#0: *2535 upstream timed out (110: Connection timed out) while connecting to upstream, client: 188.163.106.67, server: ***, request: "GET / HTTP/1.1", upstream: "http://10.2.0.4:8080/", host: "n.***.net"

nginx config
location / {
    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
      try_files $uri $uri/ @fallback;
    }
    location / {
      try_files /does_not_exists @fallback;
    }
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @fallback;
    }
  }
  location @fallback {
    proxy_pass http://10.2.0.4:8080;
    proxy_redirect http://10.2.0.4:8080 /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    access_log off ;
  }

Apache config:
...
Include conf.d/
Include vhosts-default/
Include vhosts/
Listen 127.0.0.1:8080
Listen 10.2.0.4:8080

If you open directly ip: 8080, then it works.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question