First find where the configuration file is
whereis nginx.conf
You can look through these directories to see where the configuration files are. The correct directory on my side is /etc/nginx
Second find the real configuration file
cd to the /etc/nginx directory
When I opened it, I was stunned. Where is the listen 80 line?
But don't worry, listen 80 is definitely there, but it's not there. Look, isn't there an include file? Not sure in there.
OK, then go and see what's in the sites-enabled folder
Well, this file points to the site-available/default
default file again. Once opened, um... yes it is
But make a good habit of backing up before modifying
cp default default_backup
Generally, 80 is changed to 81. In fact, it is also possible to change other things.
The next step is to restart nginx. But you will find that nginx cannot be accessed, that is because port 81 is not open, you can refer to my other blog post Modifying the port of the remote server