I’m encountering an issue with my Nginx server related to external access on port 443. While everything seems to work fine when tested internally, I'm unable to access the server from external machines. Here’s a detailed overview of what I’ve done and the specifics of my configuration:
Nginx Configuration:
server { listen 80; server_name [my_domain].com www.[my_domain].com; location / { return 301 https://$host$request_uri; }}server { listen 443 ssl; server_name [my_domain].com www.[my_domain].com; ssl_certificate /etc/letsencrypt/live/[my_domain].com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/[my_domain].com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers off; location / { proxy_pass http://localhost:8080; proxy_set_header Host $host; 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 $scheme; }}
Actions Taken:
Internal Access:
- curl works correctly from the server itself.
- telnet localhost 443 confirms that port 443 is listening.
- The backend service running on port 8080 is confirmed to be functioning properly.
External Access:
- Verified that port 443 is open in the firewall (ufw), configured toaccept connections on both IPv4 and IPv6.
- DNS configuration appears correct: dig [my_domain].com resolves tothe public IP [my_publicip] of my server.
- Requests made to the public IP [my_publicip] on port 443 using HTTP(not HTTPS) are successful, but HTTPS requests to [my_domain].com donot work from external machines.
Logs and Errors:
- No evident errors in Nginx logs (/var/log/nginx/error.log), whichonly show normal startup and shutdown process messages.
Connection Testing:
- curl -v https://[my_domain].com works internally, but I am unable toaccess the server from external machines.
- SSL certificate validation has been confirmed, ensuring that thecertificates are correctly set up and valid.
- HTTPS requests to [my_domain].com do not work from external machines.
Questions:
- What could be causing the server Nginx to be inaccessible externally,despite functioning well internally?
- Could there be any issues with the Nginx configuration or theserver's network setup?
- Any insights or suggestions would be greatly appreciated. Thank you!
NOTE: My server is located in a digital ocean droplet.