配置系統服務前價差了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)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/29638.html
標籤:AI
上一篇:云計算之Linux全堆疊目錄番外篇(教你如何破解別人root用戶密碼!!!)
下一篇:深度學習(一):什么是深度學習
