Home >Operation and Maintenance >Nginx >How to solve the problem that nginx cannot start because port 80 is occupied under windows
1. Install
to download the latest version used under windows, which is currently 1.11.10, as shown in the picture:
Just download and unzip it.
2. Run
Run nginx, error message:
[emerg] 10348#10940: bind() to 0.0.0.0:80 failed (10013: an attempt was made to access a socket in a way forbidden by its access permissions)
As shown in the picture:
can also be seen in the log, open:
nginx-1.11.10\logs\error.log
As shown:
nginx is used by default Port 80, but port 80 is occupied under Windows, check:
is occupied by a process with pid 4, check:
is a system process. Take a look in the task manager:
Sure enough.
3. Problem Solving
The solution is to stop the system process from occupying port 80, and you need to modify the registry.
3.1 Open the registry
Enter regedit
3.2 Find the registration key and modify it
Found
hkey_local_machine\system\currentcontrolset\services\http
There is a reg_dword type item start registration item:
The original value is 3:
Change to 0:
3.3 Restart the operating system
Restart windows system, the original system process will not occupy port 80.
4. Re-run nginx
Run in the nginx installation directory:
start nginx.exe
or:
nginx.exe
As shown:
You can see in the task manager that two processes will be started in the background:
5. Close nginx
nginx.exe -s stop
or:
nginx.exe -s quit
stop can stop nginx quickly, but it may not save relevant information; quit is a complete and orderly stop of nginx. This process Relevant information will be saved.
The above is the detailed content of How to solve the problem that nginx cannot start because port 80 is occupied under windows. For more information, please follow other related articles on the PHP Chinese website!