我正在尝试在 Ubuntu 16.04 上重新启动 nginix,但我一直收到这些错误消息。请注意,我是初中级水平,不太熟悉终端或 Ubuntu。请帮忙。:(
sudo systemctl 重启 nginx.service
nginx.service 的作业失败,因为控制进程退出并显示错误代码。有关详细信息,请参阅“systemctl status nginx.service”和“journalctl -xe”。
sudo 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 Tue 2017-09-12 21:38:46 UTC; 19s ago
Process: 3760 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Sep 12 21:38:46 vultr.guest systemd[1]: Stopped A high performance web server and a reverse proxy server.
Sep 12 21:38:46 vultr.guest systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 12 21:38:46 vultr.guest nginx[3760]: nginx: [emerg] unknown directive "6H%WO5!JM&Woj!RpOMIS^fPkbs&$!PEYqhU6zPlC6&uhMdo99q&NKvpwvn9rYzMkaQ27CgU!fkS20zvgto@1adbJ#6*8m^TIL*MX" in /etc/nginx/sites-enabled/mastodon:17
Sep 12 21:38:46 vultr.guest nginx[3760]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 12 21:38:46 vultr.guest systemd[1]: nginx.service: Control process exited, code=exited status=1
Sep 12 21:38:46 vultr.guest systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Sep 12 21:38:46 vultr.guest systemd[1]: nginx.service: Unit entered failed state.
Sep 12 21:38:46 vultr.guest systemd[1]: nginx.service: Failed with result 'exit-code'.*
**sudo journalctl -xe**
*Sep 12 21:20:43 vultr.guest sudo[3504]: pam_unix(sudo:session): session closed for user root
Sep 12 21:21:25 vultr.guest ntpd[1102]: 51.15.2.109 local addr 45.32.233.146 -> <null>
Sep 12 21:22:11 vultr.guest sudo[3558]: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/systemctl status nginx.service
Sep 12 21:22:11 vultr.guest sudo[3558]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 12 21:22:11 vultr.guest sudo[3558]: pam_unix(sudo:session): session closed for user root
Sep 12 21:22:21 vultr.guest sshd[3561]: Did not receive identification string from 62.75.190.193
Sep 12 21:23:54 vultr.guest sudo[3574]: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 12 21:23:54 vultr.guest sudo[3574]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 12 21:37:35 vultr.guest sudo[3720]: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/bin/systemctl restart nginx.service
Sep 12 21:37:35 vultr.guest sudo[3720]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 12 21:37:35 vultr.guest systemd[1]: Stopped A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has finished shutting down
-- Defined-By: systemd
--
-- Unit nginx.service has finished shutting down.
Sep 12 21:37:35 vultr.guest systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
--
-- Unit nginx.service has begun starting up.
Sep 12 21:37:35 vultr.guest nginx[3723]: nginx: [emerg] unknown directive "6H%WO5!JM&Woj!RpOMIS^fPkbs&$!PEYqhU6zPlC6&uhMdo99q&NKvpwvn9rYzMkaQ27CgU!fkS20zvgto@1adbJ#6*8m^TIL*MX" in /etc/nginx/sites-enabled/mastodon:17
Sep 12 21:37:35 vultr.guest nginx[3723]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 12 21:37:35 vultr.guest systemd[1]: nginx.service: Control process exited, code=exited status=1
Sep 12 21:37:35 vultr.guest systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Sep 12 21:37:35 vultr.guest systemd[1]: nginx.service: Unit entered failed state.
Sep 12 21:37:35 vultr.guest systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 12 21:37:35 vultr.guest sudo[3720]: pam_unix(sudo:session): session closed for user root
Sep 12 21:37:57 vultr.guest su[3733]: Successful su for mastodon by root
Sep 12 21:37:57 vultr.guest su[3733]: + /dev/pts/0 root:mastodon
Sep 12 21:37:57 vultr.guest su[3733]: pam_unix(su:session): session opened for user mastodon by root(uid=0)
Sep 12 21:37:57 vultr.guest su[3733]: pam_systemd(su:session): Cannot create session: Already running in a session
Sep 12 21:38:46 vultr.guest sudo[3756]: mastodon : TTY=pts/0 ; PWD=/home/mastodon ; USER=root ; COMMAND=/bin/systemctl restart nginx.service
Sep 12 21:38:46 vultr.guest sudo[3756]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 12 21:38:46 vultr.guest systemd[1]: Stopped A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has finished shutting down
-- Defined-By: systemd
--
-- Unit nginx.service has finished shutting down.
Sep 12 21:38:46 vultr.guest systemd[1]: Starting A high performance web server and a reverse proxy server...
-- Subject: Unit nginx.service has begun start-up
-- Defined-By: systemd
--
-- Unit nginx.service has begun starting up.
Sep 12 21:38:46 vultr.guest nginx[3760]: nginx: [emerg] unknown directive "6H%WO5!JM&Woj!RpOMIS^fPkbs&$!PEYqhU6zPlC6&uhMdo99q&NKvpwvn9rYzMkaQ27CgU!fkS20zvgto@1adbJ#6*8m^TIL*MX" in /etc/nginx/sites-enabled/mastodon:17
Sep 12 21:38:46 vultr.guest nginx[3760]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 12 21:38:46 vultr.guest systemd[1]: nginx.service: Control process exited, code=exited status=1
Sep 12 21:38:46 vultr.guest systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
--
-- Unit nginx.service has failed.
--
-- The result is failed.
Sep 12 21:38:46 vultr.guest systemd[1]: nginx.service: Unit entered failed state.
Sep 12 21:38:46 vultr.guest systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 12 21:38:46 vultr.guest sudo[3756]: pam_unix(sudo:session): session closed for user root
Sep 12 21:39:05 vultr.guest sudo[3770]: mastodon : TTY=pts/0 ; PWD=/home/mastodon ; USER=root ; COMMAND=/bin/systemctl status nginx.service
Sep 12 21:39:05 vultr.guest sudo[3770]: pam_unix(sudo:session): session opened for user root by root(uid=0)
Sep 12 21:39:05 vultr.guest sudo[3770]: pam_unix(sudo:session): session closed for user root
Sep 12 21:41:11 vultr.guest sudo[3775]: mastodon : TTY=pts/0 ; PWD=/home/mastodon ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 12 21:41:11 vultr.guest sudo[3775]: pam_unix(sudo:session): session opened for user root by root(uid=0)*
lines 1932-2004/2004 (END)
答案1
检查并注释掉 /etc/nginx/sites-enabled/mastodon 中的第 17 行,然后重启 nginx:
未知指令“6H%WO5!JM&Woj!RpOMIS^fPkbs&$!PEYqhU6zPlC6&uhMdo99q&NKvpwvn9rYzMkaQ27CgU!fkS20zvgto@1adbJ#6*8m^TIL*MX”