I’m trying to set up a simple personal web server using nginx. It won’t start, and I can’t even find a hint of what is wrong.
Here’s my NixOS config:
services.nginx = {
enable = true;
virtualHosts."localhost" = {
root = "/home/amy/nginx-test";
};
};
When I try to start it:
✦ ❯ systemctl restart nginx.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ====
Authentication is required to restart 'nginx.service'.
Authenticating as: Amy de Buitleir (amy)
Password:
==== AUTHENTICATION COMPLETE ====
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
Trying the first suggestion to get more info:
✦ ❯ systemctl status nginx.service
● nginx.service - Nginx Web Server
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sat 2022-07-30 21:27:16 IST; 5s ago
Process: 18229 ExecStartPre=/nix/store/ffnw8igsv4b12ffsfd8fqx51ivvyzbks-unit-script-nginx-pre-start/bin/nginx-pre-start (code=exited, st>
IP: 0B in, 0B out
CPU: 26ms
Jul 30 21:27:16 wombat11k systemd[1]: nginx.service: Control process exited, code=exited, status=135/n/a
Jul 30 21:27:16 wombat11k systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 30 21:27:16 wombat11k systemd[1]: Failed to start Nginx Web Server.
I don’t think that told me anything useful, so trying the second suggestion to get more info:
Jul 30 21:27:15 wombat11k systemd[1]: Starting Nginx Web Server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 12992.
Jul 30 21:27:16 wombat11k nginx-pre-start[18229]: /nix/store/ffnw8igsv4b12ffsfd8fqx51ivvyzbks-unit-script-nginx-pre-start/bin/nginx-pre-star>
Jul 30 21:27:16 wombat11k systemd[1]: nginx.service: Control process exited, code=exited, status=135/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 135.
Jul 30 21:27:16 wombat11k systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jul 30 21:27:16 wombat11k systemd[1]: Failed to start Nginx Web Server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 12992 and the job result is failed.
Jul 30 21:27:26 wombat11k systemd[1]: nginx.service: Scheduled restart job, restart counter is at 1.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ Automatic restarting of the unit nginx.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Jul 30 21:27:26 wombat11k systemd[1]: Stopped Nginx Web Server.
░░ Subject: A stop job for unit nginx.service has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A stop job for unit nginx.service has finished.
░░
░░ The job identifier is 13072 and the job result is done.
Jul 30 21:27:26 wombat11k systemd[1]: Starting Nginx Web Server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 13072.
Jul 30 21:27:26 wombat11k nginx-pre-start[18324]: /nix/store/ffnw8igsv4b12ffsfd8fqx51ivvyzbks-unit-script-nginx-pre-start/bin/nginx-pre-star>
Jul 30 21:27:26 wombat11k systemd[1]: nginx.service: Control process exited, code=exited, status=135/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 135.
Jul 30 21:27:26 wombat11k systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jul 30 21:27:26 wombat11k systemd[1]: Failed to start Nginx Web Server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 13072 and the job result is failed.
Jul 30 21:27:36 wombat11k systemd[1]: nginx.service: Scheduled restart job, restart counter is at 2.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ Automatic restarting of the unit nginx.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Jul 30 21:27:36 wombat11k systemd[1]: Stopped Nginx Web Server.
░░ Subject: A stop job for unit nginx.service has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A stop job for unit nginx.service has finished.
░░
░░ The job identifier is 13152 and the job result is done.
Jul 30 21:27:36 wombat11k systemd[1]: Starting Nginx Web Server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 13152.
Jul 30 21:27:36 wombat11k nginx-pre-start[18339]: /nix/store/ffnw8igsv4b12ffsfd8fqx51ivvyzbks-unit-script-nginx-pre-start/bin/nginx-pre-star>
Jul 30 21:27:36 wombat11k systemd[1]: nginx.service: Control process exited, code=exited, status=135/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 135.
Jul 30 21:27:36 wombat11k systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jul 30 21:27:36 wombat11k systemd[1]: Failed to start Nginx Web Server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 13152 and the job result is failed.
Jul 30 21:27:46 wombat11k systemd[1]: nginx.service: Scheduled restart job, restart counter is at 3.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ Automatic restarting of the unit nginx.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Jul 30 21:27:46 wombat11k systemd[1]: Stopped Nginx Web Server.
░░ Subject: A stop job for unit nginx.service has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A stop job for unit nginx.service has finished.
░░
░░ The job identifier is 13232 and the job result is done.
Jul 30 21:27:46 wombat11k systemd[1]: Starting Nginx Web Server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 13232.
Jul 30 21:27:46 wombat11k nginx-pre-start[18353]: /nix/store/ffnw8igsv4b12ffsfd8fqx51ivvyzbks-unit-script-nginx-pre-start/bin/nginx-pre-star>
Jul 30 21:27:46 wombat11k systemd[1]: nginx.service: Control process exited, code=exited, status=135/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 135.
Jul 30 21:27:46 wombat11k systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jul 30 21:27:46 wombat11k systemd[1]: Failed to start Nginx Web Server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 13232 and the job result is failed.
Jul 30 21:27:56 wombat11k systemd[1]: nginx.service: Scheduled restart job, restart counter is at 4.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ Automatic restarting of the unit nginx.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
Jul 30 21:27:56 wombat11k systemd[1]: Stopped Nginx Web Server.
░░ Subject: A stop job for unit nginx.service has finished
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A stop job for unit nginx.service has finished.
░░
░░ The job identifier is 13312 and the job result is done.
Jul 30 21:27:56 wombat11k systemd[1]: Starting Nginx Web Server...
░░ Subject: A start job for unit nginx.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has begun execution.
░░
░░ The job identifier is 13312.
Jul 30 21:27:57 wombat11k nginx-pre-start[18364]: /nix/store/ffnw8igsv4b12ffsfd8fqx51ivvyzbks-unit-script-nginx-pre-start/bin/nginx-pre-star>
Jul 30 21:27:57 wombat11k systemd[1]: nginx.service: Control process exited, code=exited, status=135/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 135.
Jul 30 21:27:57 wombat11k systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jul 30 21:27:57 wombat11k systemd[1]: Failed to start Nginx Web Server.
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 13312 and the job result is failed.