Home  >  Article  >  Operation and Maintenance  >  When I use the systemctl command to start nginx, I get an error? what reason?

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

王林
王林forward
2020-12-01 15:16:534022browse

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]

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)

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端口使用情况

Remove the nginx process to ss

pkill nginx

Use system mode to start again

systemctl start nginx

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!

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