When I use the systemctl command to start nginx, I get an error? what reason?

王林
Release: 2020-12-01 15:16:53
forward
4005 people have browsed it

When I use the systemctl command to start nginx, I get an error? what reason?

Question:

Use the systemctl start nginx command to start nginx and find an error. The error content is as follows:

Recommended tutorial: nginx tutorial

Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.[object Object]
Copy after login

Problem analysis:

nginx -t Check that there is no problem

systemctl status nginx Check the nginx status, and the error message is that port 80 is occupied

Jul 13 16:18:18 web01 nginx[2407]:nginx:[emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Copy after login

Cause analysis:

The nginx command was used to start during installation. After modifying the configuration file, the systemctl restart nginx command was used to start.

Port 80 was occupied when the nginx command was started. Use systemctl restart nginx and run to port 80 again, resulting in a conflict error

Solution:

Check the nginx port status

ps -ef|grep nginx #查看nginx端口使用情况
Copy after login

Remove the nginx process to ss

pkill nginx
Copy after login

Use system mode to start again

systemctl start nginx
Copy after login

The above is the detailed content of When I use the systemctl command to start nginx, I get an error? what reason?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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