Fix Nginx that will not start
We'll check config with nginx -t, inspect status with systemctl and journalctl, fix syntax and permission errors, and resolve port conflicts—or tell you when to escalate.
What you'll need
- SSH or console access with sudo
Step-by-step diagnostic
Quick triage — pick your path
Quick triage — pick your path
Choose the option that matches what you see. You can jump straight to that section.
- Follow this guide Work through the full procedure from nginx -t to fixing the config.
- Check config syntax You want to confirm the config is valid first.
- Check status and logs You want to see the error from systemctl and journalctl.
- Fix port conflict You suspect another service is using port 80 or 443.
- When to escalate Config management or application-level fix needed.
Show full guide
Steps
Goal: Check config with nginx -t, inspect status and logs, fix syntax and permission errors, and resolve port conflicts.
- Run
sudo nginx -tto check config syntax. If it fails, fix the reported file and line. - Run
systemctl status nginxandjournalctl -u nginx -n 50to see the error. - Good: You see the cause. Proceed to Check config syntax or Fix port conflict.
- Bad: Run nginx in foreground (
sudo nginx) to capture startup output.
Check config syntax
Goal: Confirm the config is valid before starting.
- Run
sudo nginx -t. Syntax errors (missing semicolons, unclosed braces, invalid directives) prevent start. - Good: “syntax is ok” and “test is successful”. Proceed to Check status and logs.
- Bad: Fix the file and line reported. Run nginx -t again until it passes.
Check status and logs
Goal: See the current state and error from systemctl and journalctl.
- Run
systemctl status nginxfor state. Runjournalctl -u nginx -n 50for the error. - Common causes: address already in use (port conflict), permission denied (config or log dirs), file not found.
- Good: Error identified. Proceed to Fix port conflict or fix permissions.
- Bad: Run
sudo nginxin foreground to see startup output.
Fix port conflict
Goal: Free port 80 or 443 if another service uses it.
- Run
ss -tlnporlsof -i :80andlsof -i :443. Apache or another web server may be using the port. - Stop the conflicting service or change the Listen directive in nginx config.
- Good: Port is free. Run
sudo systemctl start nginx. Confirm you should see active (running). - Bad: If you cannot stop the conflicting service, change nginx to listen on a different port.
When to escalate
Escalate if:
- Nginx is managed by config management.
- The fix requires application-level changes.
- You cannot safely modify the config.
Provide nginx -t output, systemctl status, and journalctl output.
Verification
sudo nginx -treports “syntax is ok” and “test is successful”.systemctl status nginxshows active (running).- No errors in journalctl -u nginx.
- Nginx serves requests (e.g. curl localhost returns a response).
Escalation ladder
Work from the device outward. Stop when the problem is fixed.
- Config test nginx -t to check syntax.
- Status and logs systemctl status nginx; journalctl -u nginx.
- Fix config and permissions Fix syntax errors; chown/chmod for nginx user.
- Port conflicts ss -tlnp or lsof; stop conflicting service or change port.
- Escalate Provide nginx -t, status, journalctl.
What to capture if you need help
Before calling support or posting for help, have these ready. It speeds everything up.
- nginx -t output
- systemctl status nginx output
- journalctl -u nginx -n 50 output
- ss -tlnp or lsof -i :80 output (if port conflict)
- Steps already tried
Does nginx -t pass?
Run sudo nginx -t. Syntax errors prevent start.
You can change your answer later.
Fix config syntax
What does journalctl show?
Read the last 50 lines of nginx logs.
You can change your answer later.
Apply fix
You can change your answer later.
Done
Test manually or escalate
Reviewed by Blackbox Atlas
Frequently asked questions
- Why would Nginx not start?
- Config syntax error, port already in use, permission denied on config or log dirs, or missing modules. Run nginx -t and journalctl -u nginx first.
- Can I fix Nginx that will not start myself?
- Yes. Run nginx -t to find config errors, fix the config, check port conflicts with ss -tlnp, and confirm permissions. Reload with systemctl daemon-reload.
- When should I escalate Nginx start failures?
- If Nginx is managed by config management, the fix requires application-level changes, or you cannot safely modify the config.
Rate this guide
Was this helpful?
Thanks for your feedback.