I'm working with Ubuntu 16.04 ang Nginx running Port 80 and 443. I use Proxy_Pass to forward traffic to Apache listening on Port 8080. Both Nginx and Apache are on the same server.
Problem is that Nginx can't seem to forward traffic to Apache. I'm getting 504 Gateway Timeout Error. I can confirm that Apache is running and receiving traffic on Port 8080.
I use proxy_pass extensively in my setup. And the traffic forwarded to Apache on Port 8080 on a different server is working fine. My only issue is this one with the Apache running on the same server as Nginx.
I've tried to set Apache
listen 8080 and
listen 127.0.0.1:8080 but I get the same error.
In Nginx I used
proxy_pass http://localhost:8080; and
proxy_pass http://127.0.0.1:8080 but the results are the same.
The only thing I find different is that if I run
netstat -tulpn while Apache uses
listen 8080, Port 8080 only appears in tcp6 as
:::8080. It does not seem to be open in tcp (IPv4). But with
listen 127.0.0.1:8080 tcp (IPv4) specifically opens
127.0.0.1:8080 but not anymore in tcp6. If I understand this correctly, it should be open on both IPv4 and IPv6 with Local Address showing as
0.0.0.0:8080 in IPv4 and
:::8080 in IPv6.
Note that Firewall is not enabled.
I've trying to go over my config but to no avail. My setup is working if I forward it to a different server. I think this is something port or binding related? But I can't seem to find the answer. Been Googling but could not find a solution.
Hope someone has an idea what I'm doing wrong.