Home >Operation and Maintenance >Nginx >How to solve the problem that nginx cannot start because port 80 is occupied under windows

How to solve the problem that nginx cannot start because port 80 is occupied under windows

王林
王林forward
2023-05-16 21:56:362504browse

1. Install

to download the latest version used under windows, which is currently 1.11.10, as shown in the picture:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

Just download and unzip it.

How to solve the problem that nginx cannot start because port 80 is occupied under windows

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:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

can also be seen in the log, open:

nginx-1.11.10\logs\error.log

As shown:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

nginx is used by default Port 80, but port 80 is occupied under Windows, check:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

is occupied by a process with pid 4, check:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

is a system process. Take a look in the task manager:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

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

How to solve the problem that nginx cannot start because port 80 is occupied under windows

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:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

The original value is 3:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

Change to 0:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

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:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

You can see in the task manager that two processes will be started in the background:

How to solve the problem that nginx cannot start because port 80 is occupied under windows

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete