為什麼我的 nginx 正在尋找一個名稱奇怪的 conf 檔案?

為什麼我的 nginx 正在尋找一個名稱奇怪的 conf 檔案?

我有一個運行 raspbian (debian 9.3) 的 Raspberry Pi,直到今晚才出現問題。我使用 nginx 為 https 網站提供服務,並且需要使用 certbot 更新我的證書,因此我停止了 nginx。但當我再次開始時,這就是我得到的:

pi@framboise3:~ $ sudo service nginx start
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
pi@framboise3:~ $ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-01-31 21:34:49 UTC; 10s ago
     Docs: man:nginx(8)
  Process: 1791 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

janv. 31 21:34:49 framboise3 systemd[1]: Starting A high performance web server and a reverse proxy server...
janv. 31 21:34:49 framboise3 nginx[1791]: nginx: [emerg] open() "/etc/nginx+ngijx.conf" failed (2: No such file or directory)
janv. 31 21:34:49 framboise3 nginx[1791]: nginx: conbiguration file /etc/nginx+ngijx.conf test failed
janv. 31 21:34:49 framboise3 systemd[1]: nginx.service: Control process exited, code=exited status=1
janv. 31 21:34:49 framboise3 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
janv. 31 21:34:49 framboise3 systemd[1]: nginx.service: Unit entered failed state.
janv. 31 21:34:49 framboise3 systemd[1]: nginx.service: Failed with result 'exit-code'.

請注意兩個非常奇怪的項目:「」這個詞設定檔“和文件”/etc/nginx+ngijx.conf" 看起來有點像是預期的 /etc/nginx/nginx.conf。當然,提到的那個並不存在。

到底發生了什麼事?

apt-get刪除並安裝nginx並沒有解決問題。我在 /etc 和 /var/lib/nginx/ 中都沒有發現字串“ngijx”(不知道它是否相關)。

除此之外,我沒有發現系統有任何問題。有人告訴我這可能是 SD 卡有缺陷,但為什麼重新安裝軟體包不能解決問題呢?我可以測試我的卡片是否有缺陷嗎?謝謝

答案1

在回复 Seth 時查找詳細信息,我更進一步並解決了問題。首先我注意到這一點:

pi@framboise3:/etc $ strings /usr/sbin/nginx |grep ngij
/etc/nginx+ngijx.conf

這意味著該檔案(ELF 32 位元可執行檔)因某種原因已損壞。

然後我跑了:

pi@framboise3:/etc $  dpkg -S /usr/sbin/nginx
nginx-full: /usr/sbin/nginx

並了解重新安裝“nginx”不是正確的軟體包。重新安裝 nginx-full 就成功了。它是如何損壞的仍然是一個謎,我想我會仔細檢查我的備份系統...

相關內容