How to stop Nginx to listen to port 80?

Solution 1:

As you have commented out the listen directive nginx will fall back to it's default behaviour which is to listen on port 80 as it says in the comment after the ##.

To have nginx listen elsewhere you need to tell it to do that using a listen directive e.g.

listen 8080; 

or

listen 192.168.2.3:8080;