-3

I am trying to restart nginix on Ubuntu 16.04, but I keep getting these error messages. Please note that I am beginner-intermediate at navigating through the terminal, or through Ubuntu. Please help. :(

sudo systemctl restart nginx.service

Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

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)
  • "sudo service nginx restart" is the typical method. If it doesn't work the output gives you some guidance on commands to run - run them and edit your post to include the output. – Tim Sep 12 '17 at 21:39
2

Check and comment the line 17 in /etc/nginx/sites-enabled/mastodon and restart nginx:

unknown directive "6H%WO5!JM&Woj!RpOMIS^fPkbs&$!PEYqhU6zPlC6&uhMdo99q&NKvpwvn9rYzMkaQ27CgU!fkS20zvgto@1adbJ#6*8m^TIL*MX"

  • Hmm, how did that get in there. 🤣 What do I replace that with? Or do I just delete it? Sorry if it's a stupid question. I'm still learning how to navigate and why everything means. – FreeDroid Sep 12 '17 at 22:17
  • Actually, problem solved! Thank you so very much, and good eye. – FreeDroid Sep 12 '17 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.