I'm currently trying to get nginx set up to help me run a website from home. I've followed the following instructions to set up nginx:
sudo apt update
sudo apt install nginx
sudo ufw app list
sudo ufw allow 'Nginx HTTP'
sudo ufw status
Once I try to run sudo systemctl start nginx
, I get
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
Running systemctl status nginx
I get the following:
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 2020-04-08 16:00:43 BST; 9min ago
Docs: man:nginx(8)
Process: 8820 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Apr 08 16:00:43 AMCosyClub systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 08 16:00:43 AMCosyClub nginx[8820]: nginx: [emerg] directive "root" is not terminated by ";" in /etc/nginx/conf.d/writefreely.conf:6
Apr 08 16:00:43 AMCosyClub nginx[8820]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 08 16:00:43 AMCosyClub systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 08 16:00:43 AMCosyClub systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 08 16:00:43 AMCosyClub systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Running journalctl -xe
produces
Apr 08 16:00:43 AMCosyClub nginx[8820]: nginx: configuration file /etc/nginx/nginx.conf test failed
Apr 08 16:00:43 AMCosyClub systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 08 16:00:43 AMCosyClub systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 08 16:00:43 AMCosyClub systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: Unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit nginx.service has failed.
--
-- The result is RESULT.
Apr 08 16:00:43 AMCosyClub sudo[8817]: pam_unix(sudo:session): session closed for user root
Apr 08 16:00:49 AMCosyClub systemd[1]: Started Run anacron jobs.
-- Subject: Unit anacron.service has finished start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit anacron.service has finished starting up.
--
-- The start-up result is RESULT.
Apr 08 16:00:49 AMCosyClub anacron[8821]: Anacron 2.3 started on 2020-04-08
Apr 08 16:00:49 AMCosyClub anacron[8821]: Normal exit (0 jobs run)
Apr 08 16:02:26 AMCosyClub kernel: [UFW BLOCK] IN=wlp8s0 OUT= MAC=redacted SRC=redacted DST=redacted LEN=36 TOS=0x
[1]+ Stopped journalctl -xe
I have checked in the nginx error log and it repeats the following:
[emerg] 8820#8820: directive "root" is not terminated by ";" in /etc/nginx/conf.d/writefreely.conf:6
I'm a total novice when it comes to this stuff so any help would be greatly appreciated. Please let me know if I could provide any further details / run specific commands to help further clarify what is going on. THanks!