I have got a Google Cloud VM with Firewall configured to allow tcp:8080 and tcp:80
I've also configured ufw:
To Action From
-- ------ ----
Nginx HTTP ALLOW Anywhere
8080 ALLOW Anywhere
Nginx HTTP (v6) ALLOW Anywhere (v6)
8080 (v6) ALLOW Anywhere (v6)
And checked that port 8080 is open:
> sudo nmap -sT -O localhost
PORT STATE SERVICE
80/tcp open http
8080/tcp open http-proxy
Nginx config:
events {
worker_connections 1024;
}
http {
server {
listen 8080;
location /some_endpoint {
proxy_pass http://localhost:<port>/<route>;
}
}
Then I'm running an nginx on host (without container, just on the VM itself) and in this configutarion I cannot access my machine from the internet - "The connection has timed out", no errors in error.log and nothing in access.log
But! If I'm running same version of nginx with the same config file in the docker in the same VM, then everything is OK and nginx can be reached through the internet.
I'm really struggling to understand what am I doing wrong and how to properly run nginx on a VM itself.
Edit: additional info:
Output of
sudo netstat -tulpn | grep LISTEN
:
tcp 0 0 127.0.0.1:8099 0.0.0.0:* LISTEN 6149/traefik
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 14761/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 542/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 797/sshd: /usr/sbin
Output of
curl -v <url>
:
* Trying <URL>...
* connect to <URL> port 8080 failed: Timed out
* Failed to connect to <URL> port 8080 after 21045 ms: Timed out
* Closing connection 0
curl: (28) Failed to connect to <URL> port 8080 after 21045 ms: Timed out