Home  >  Article  >  Operation and Maintenance  >  How to modify nginx port

How to modify nginx port

藏色散人
藏色散人Original
2019-08-08 09:52:3615903browse

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

How to modify nginx port

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

How to modify nginx port

When I opened it, I was confused. Where is the line listen 80?

How to modify nginx port

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

How to modify nginx port

Okay, this file points to site-available/default

As soon as the default file is opened, um...that’s it.

How to modify nginx port

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to download nginxNext article:How to download nginx