Home > Enterprise >  My Nginx service is running and if I run curl localhost it shows landing page HTML. But cannot acces
My Nginx service is running and if I run curl localhost it shows landing page HTML. But cannot acces

Time:06-16

When I ping my localhost or ip 127.0.0.1 it returns nginx landing page html. But from my public IP I cannot access it. I reinstalled nginx. But issue didn't solved

ubuntu@ip-my-ip:~$ curl 127.0.0.1

        <html>
        <head>
        <title>Welcome to nginx!</title>
        <style>
            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>```

CodePudding user response:

Check the Inbound Rules for the Security Group that your Ec2 instance belongs.

By default when launching an Ec2 instance the Inbound SSH traffic is allowed from everywhere, but the HTTP and HTTPS are not:

enter image description here

To edit the configuration after lunch the instance:

  • In AWS EC2 -> Go to Instance and find your instance Security Group Name.

  • Sill in AWS EC2 -> scroll the left panel until the Security Group in "Network & Security" -> Find the Security Group that your EC2 instance belongs to and edit the Inbound rules to allow HTTP (Port 80) and HTTPS (Port 443) from your IP or any IP.

  • Related