3

I have an Nginx server in EC2. It's in a VPC on a public subnet that's attached to an internet gateway. The security group is configured to allow traffic on port 80 and 443. The instance is running on Ubuntu 24.04 in AWS.

From a tcpdump, I can see that the server is receiving traffic on port 80 for both the private and public IPs, but only the private IP returns results.

For testing, I've disabled the ufw:

$ sudo ufw status 

Output:

Status: inactive

tcpdump

sudo tcpdump -i any port 80 

Output:

tcpdump: data link type LINUX_SLL2 tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes 18:45:57.854950 ens5 In IP .8298 >

Nginx config

I am very new to Nginx and just trying to get a basic system setup at this point, so I'm using the default configuration until I can get the public IP working. I want to work through one issue at a time.

server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; } } 

Private IP Curl

$ curl http://<private_ip>/ 

Output:

<!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> html { color-scheme: light dark; } body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html> 

Public IP Curl

$ curl http://<public_ip> 

curl: (28) Failed to connect to <public_ip> port 80 after 75010 ms: Couldn't connect to server

3
  • Are you trying to connect to the public IP from the public Internet or the private network? Can you ping it? Commented Sep 8 at 19:52
  • I can ping the private IP but the public IP times out. I am using a VPN that gives me access to the private IPs. That said, I have a second server with a public IP that is serving content via a public IP and it also times out when I try to ping it so maybe AWS is blocking ICMP? Commented Sep 8 at 20:13
  • can you show the permission you give to the instance Security Group? Commented Sep 19 at 10:23

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.