Home > Article > Operation and Maintenance > How to modify nginx port
How to modify the nginx port?
How to modify the nginx port:
First find where the configuration file is
whereis nginx.conf
You You can look through these directories to see where the configuration files are. The correct directory here is /etc/nginx
Secondly find the real configuration file
cd to the /etc/nginx directory
When I opened it, I was confused. Where is the line listen 80?
But don’t worry, there must be listen 80, but it’s just not included here. Look, isn't there an include file? Maybe it's in there.
Okay, then go and see what is in the sites-enabled folder
Okay, this file points to site-available/default
As soon as the default file is opened, um...that’s it.
But develop a good habit and back it up before modifying it
cp default default_backup
Usually it is Change 80 to 81, but you can actually change it to something else.
The next step is to restart nginx. But you will find that nginx cannot be accessed, because port 81 is not open.
For more Nginx related technical articles, please visit the Nginx usage tutorial column to learn!
The above is the detailed content of How to modify nginx port. For more information, please follow other related articles on the PHP Chinese website!