장벽 집합 - Nginx 와 Apache 설정 시스템 서비스 systemctl start 오류, Job for nginx. service failed because the control process

시스템 서 비 스 를 설정 하기 전에 nginx 설정 이 잘못 되 지 않 았 습 니 다.
[root@localhost system]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

**      ,  systemctl   ,      ,          。``**`
```csharp
[root@localhost system]# cd /lib/systemd/system
[root@localhost system]# vi nginx.service 
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/bin/kill -s HUP $MAINPID
ExecStop=/usr/bin/ki11 -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@localhost system]# systemctl start nginx   //    ,     
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
[root@localhost system]# systemctl status nginx.service    //         
● nginx.service - nginx
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2020-09-12 18:28:58 CST; 10s ago
  Process: 17948 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=1/FAILURE)

Sep 12 18:28:55 localhost.localdomain nginx[17948]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
Sep 12 18:28:55 localhost.localdomain nginx[17948]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
Sep 12 18:28:56 localhost.localdomain nginx[17948]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
Sep 12 18:28:56 localhost.localdomain nginx[17948]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
Sep 12 18:28:57 localhost.localdomain nginx[17948]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address alr...use)
Sep 12 18:28:57 localhost.localdomain nginx[17948]: nginx: [emerg] still could not bind()
Sep 12 18:28:58 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Sep 12 18:28:58 localhost.localdomain systemd[1]: Failed to start nginx.
Sep 12 18:28:58 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Sep 12 18:28:58 localhost.localdomain systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

이전 nginx 서비스 가 시작 되 었 을 때 만 Pkill 이 nginx 의 모든 프로 세 스 를 죽 이 고 systemctl start 를 다시 시작 하면 됩 니 다.
[root@localhost system]# pkill "nginx"   //      
[root@localhost system]# systemctl start nginx  //      
[root@localhost system]# systemctl status nginx.service   //    ,       
● nginx.service - nginx
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-09-12 18:29:36 CST; 2s ago
  Process: 17973 ExecStart=/usr/local/nginx/sbin/nginx (code=exited, status=0/SUCCESS)

좋은 웹페이지 즐겨찾기