Diagnose why a systemd service fails using status and journal evidence. Apply the fix, restart cleanly, confirm runtime health, and ensure the service is enabled for future boots.
The
nginx.service
is failing to start on boot. You must investigate the cause,
fix it, and ensure it runs now and on future boots.
This is a standard production workflow: confirm failure, pull the exact error from the journal, resolve the root cause, then prove it stays healthy after restart and across reboots.
systemctl status
.
journalctl -xeu
.
active (running)
.
systemctl enable
.
systemctl status
.
journalctl -xeu <unit>
.
Address already in use
) as a failure mode.
systemctl restart
and validating runtime state.
systemctl enable
and recognizing the created target symlink.
systemctl status nginx
This is your initial triage view: loaded state, enablement,
active state, and the failing
ExecStart
context. If it is failing, your next step is the journal for
the exact error text.
● nginx.service - A high performance web server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since ...
Docs: man:nginx(8)
Process: 1356 ExecStart=/usr/sbin/nginx -g 'daemon on;' (code=exited, status=1/FAILURE)
journalctl -xeu nginx
This filters the journal to just the
nginx
unit while showing the most relevant recent errors. The goal
is to extract the root-cause line, not to guess.
Jul 18 12:43:01 nginx[1356]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jul 18 12:43:01 systemd[1]: nginx.service: Failed with result 'exit-code'.
The bind failure means something else is already listening on port 80. After resolving the conflict, restart nginx.
sudo systemctl restart nginx
A restart re-runs the unit’s start sequence. If the root
cause is actually fixed, the unit should transition to
active (running)
.
systemctl status nginx
● nginx.service - A high performance web server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: active (running) since ...
sudo systemctl enable nginx
Enabling a unit creates the appropriate symlink in the
target’s wants directory (commonly
multi-user.target.wants
for server services). This is how you make behavior persist
across reboots.
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service
systemctl status <unit>
: Shows loaded state, active state, recent logs, and failure
reason for a systemd unit.
journalctl -xeu <unit>
: Displays recent, detailed journal entries for a specific
systemd unit.
-x
: Adds explanatory text when available.
-e
: Jumps to the end of the log.
-u
: Filters by unit.
systemctl restart <unit>
: Restarts the unit immediately.
systemctl enable <unit>
: Enables the unit to start automatically on boot (creates a
symlink under the appropriate target wants directory).