I have an NGINX Port Problem
I’m using nginx with 3 server blocks. I’ve added a 4th server block, but since I didn’t had an active domain name, in “server_name” i’ve added my droplet’s IP address and I’ve also added “listen 81;” so I could easy access my development project.
Today I’ve bought a domain name, I’ve changed the “server_name” to the actual domain name, and removed “listen 81;” I’ve restarted nginx, and I’ve had problems.
First, when I tried to access the domain name, it returned an error and it came up like www.domain.com:81. When I tried to access the IP address on my droplet, it also came up like xx.xx.xx.xx:81.
My other 3 sites are functioning without any problems, and I cannot trace the problem with my newly added site. I’ve doubled checked the config but it’s identitcal to the other server blocks.
Can someone point me as to what might be the problem? Why is my droplet’s IP adress responding to 81, and why is my new domain responding to 81? And why I’m not getting any kind of response, just an error?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.