Nginx

刪除 nginx 編譯

  • May 21, 2018

我通過從 git 複製和安裝 nginx 在我的 ubuntu 伺服器上編譯了 nginx(1.13.6)。我想用其他模組重新編譯它。當我嘗試使用以下方法刪除 nginx 時:

sudo service nginx stop
sudo rm -f -R /usr/local/nginx && rm -f /usr/local/sbin/nginx

輸入時我得到以下輸出sudo service nginx status,表明 nginx 尚未完全刪除。

   ● nginx.service
  Loaded: error (Reason: Invalid argument)
  Active: inactive (dead)

systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:19] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: nginx.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
systemd[1]: [/lib/systemd/system/nginx.service:6] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: [/lib/systemd/system/nginx.service:19] Unknown lvalue 'KillStop' in section 'Service'
systemd[1]: nginx.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

如何完全刪除 nginx 以從頭開始重新編譯?

您已刪除 nginx。您沒有刪除 systemd 單元文件,也沒有停用它。

要停用服務,請執行systemctl disable nginx. 要刪除單元文件,請刪除文件/lib/systemd/system/nginx.service.

引用自:https://serverfault.com/questions/913055