nginx not serving requests to external IP address
Solution 1
You have server name as
server_name 109.123.x.x;
This is wrong !!!!!
Put any name not number like
server_name mywebsite.home;
and put mywebsite.home as the IP of the nginx server in your host file(/etc/hosts) i.e in your mac like in format
109.123.X.X mywebsite.home
where X.X gets replaced with numbers
or
If you want to serve all the request , simply put
server_name _;
If that does not solve the things , check below
It's either your firewall i.e iptables blocking your traffic or you have your nginx listening only at localhost i.e 127.0.0.1
Disable firewall
sudo ufw disable
Check the listening address for port 81
sudo netstat -tulpn
Solution 2
I had the same problem a few months ago when I was trying to run ngnix on my Ubuntu system and access the services from another Windows system. I was not able to access any port service like http://127.0.0.1/8000 but after some time, I fixed this by turning off the firewall on my Ubuntu system.
Command to turn off the firewall:
sudo ufw disable
You can also check the status of your firewall first:
sudo ufw status
Related videos on Youtube
mike braa
Updated on September 18, 2022Comments
-
mike braa almost 2 years
I'm using bootstrap grid. And col-sm-1 is too small but col-sm-2 is too big. I would like to have exact middle one, col-sm-1.5. But when I do it, the whole bootstrap grid collapses. Is there a way to do such grid system?
-
Salman A over 8 yearsI think you could use
col-sm-2
and add a child element with width = 75%? -
mike braa over 8 years@SalmanA then I have to change everything for other parts as well, i like the way col-sm8 and col-sm-2 is right now
-
-
Eamorr over 12 yearsI switched to port 8080 and it's working now. Might be something to do with a priviliged port or maybe my 3G connection blocks port 81. Anyway, it's working now. Many thanks for your help.
-
radtek over 9 yearsIf its an instance in the cloud like rackspace or AWS, check your Security Groups. By default port 22 and 80 are the only ones usually open.
-
mike braa over 8 yearsif I extent it then the best part of bootstrap dissapears; "works in mobile"
-
hookenz almost 8 yearsServer name should never really be an IP.
-
GG_Python almost 8 yearsthe
sudo ufw disable
did it for me. -
Gabriel Glenn over 5 yearsAccording to the nginx doc, using ip address has server_name is not wrong. "If someone makes a request using an IP address instead of a server name, the “Host” request header field will contain the IP address and the request can be handled using the IP address as the server name":
-
Benjamin almost 4 yearsThe firewall was the problem for me too. In my case (on Fedora 32) I used systemctl stop firewalld to check it.