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

王林
Release: 2023-05-16 21:56:36
forward
2448 people have browsed it

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)
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

or:

nginx.exe
Copy after login

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
Copy after login

or:

nginx.exe -s quit
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!