0

On Alibaba Cloud ECS instance I have NGINX working normally, I can ping it from my terminal but I can't access my site from the browser.

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

service nginx status

    ● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-06-04 05:33:26 CST; 30min ago
     Docs: man:nginx(8)
  Process: 1737 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
  Process: 558 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 442 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 1714 (nginx)
    Tasks: 2 (limit: 1129)
   CGroup: /system.slice/nginx.service
           ├─1714 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─1738 nginx: worker process

when I point to my IP no response! Where is the problem?

trying the suggested fixes gave the following respose from the terminal

2 Answers2

1

It's problem with your Firewall, try to allow port 80 / 443

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

And check the port is listen to 0.0.0.0 with

sudo netstat -tunalp | grep 80
sudo netstat -tunalp | grep 443

If it's not solve your problem with your internal security group on alibaba Console

  • Go to ECS Console.
  • in tab Network & Security, choose Security Groups

And make sure you have allow port 80 / 443 or if you want allow all port int security Groups like this

Mas Dimas
  • 183
  • 2
  • 11
  • followed all your valuable suggestions .. still no response on the browser. throws 504 Gateway Time-out The server didn't respond in time. – Taha Mahmoud Sep 08 '20 at 13:17
  • A 503 Service Unavailable Error is an HTTP response status code indicating that a server is temporarily unable to handle the request. This may be due to the server being overloaded or down for maintenance. – Mas Dimas Sep 09 '20 at 14:23
  • Check the firewall and security group please – Osamazx Sep 17 '20 at 15:21
0

Did you selected Assign Public IP Address when you created ECS instance? It sounds to me like it does not have NatPublicIP address assigned during creation process of ECS.

Try to open ports:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Then try further to inspect ports:

sudo lsof -P -n -i :80 -i :443 | grep LISTEN

Check the status of local host:

curl -i http://127.0.0.1/nginx_status

Also try to restart server:

sudo service nginx restart
sudo service nginx reload

If this does not help, try to go in debug mode and trace common errors.

If this does not help, go from the start with instance and nginx installation.

Hope this would give you idea about what step was missed.

  • thanks for the clear answer. so far the ufw status is: allow From anywhere for Nginx HTTP , 80/tcp , 443/tcp . the ip is pingable from the terminal and can't be resolved from the browser , Nginx access.log is blank despite all what suggested. seems to be a kernel problem of my ubunto instance at AliCloud.. I'll delete it and run a fresh one.. thanks – Taha Mahmoud Jun 08 '20 at 21:45