Fix Apache that will not start

We'll check config with apachectl configtest, inspect status with systemctl and journalctl, fix syntax and permission errors, and resolve port conflicts—or tell you when to escalate.

Category
Troubleshooting · Servers & Linux
Time
15–30 min
Last reviewed
What you'll need
  • SSH or console access with sudo

Step-by-step diagnostic

Step 1 of 6
Show full guide

Steps

Goal: Check config with apachectl configtest, inspect status and logs, fix syntax and permission errors, and resolve port conflicts.

  • Run sudo apachectl configtest (or apache2ctl configtest on Debian) to check config syntax. If it fails, fix the reported file and line.
  • Run systemctl status apache2 (or httpd on RHEL) and journalctl -u apache2 -n 50 to see the error.
  • Good: You see the cause. Proceed to Check config syntax or Fix port conflict.
  • Bad: Run Apache in foreground (sudo apachectl -X) to capture startup output.

Check config syntax

Goal: Confirm the config is valid before starting.

  • Run sudo apachectl configtest (Debian: apache2ctl configtest). Syntax errors (missing quotes, unclosed directives, invalid options) prevent start.
  • Good: “Syntax OK”. Proceed to Check status and logs.
  • Bad: Fix the file and line reported. Run configtest again until it passes.

Check status and logs

Goal: See the current state and error from systemctl and journalctl.

  • Run systemctl status apache2 (or httpd) for state. Run journalctl -u apache2 -n 50 (or -u httpd) for 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 apachectl -X in foreground to see startup output.

Fix port conflict

Goal: Free port 80 or 443 if another service uses it.

  • Run ss -tlnp or lsof -i :80 and lsof -i :443. Nginx or another web server may be using the port.
  • Stop the conflicting service or change the Listen directive in Apache config.
  • Good: Port is free. Run sudo systemctl start apache2 (or httpd). Confirm you should see active (running).
  • Bad: If you cannot stop the conflicting service, change Apache to listen on a different port.

When to escalate

Escalate if:

  • Apache is managed by config management.
  • The fix requires application-level changes.
  • You cannot safely modify the config.

Provide apachectl configtest output, systemctl status, and journalctl output.

Verification

  • sudo apachectl configtest reports “Syntax OK”.
  • systemctl status apache2 (or httpd) shows active (running).
  • No errors in journalctl -u apache2.
  • Apache serves requests (e.g. curl localhost returns a response).

Escalation ladder

Work from the device outward. Stop when the problem is fixed.

  1. Config test apachectl configtest to check syntax.
  2. Status and logs systemctl status apache2; journalctl -u apache2.
  3. Fix config and permissions Fix syntax errors; chown/chmod for www-data or apache user.
  4. Port conflicts ss -tlnp or lsof; stop conflicting service or change port.
  5. Escalate Provide apachectl configtest, status, journalctl.

What to capture if you need help

Before calling support or posting for help, have these ready. It speeds everything up.

  • apachectl configtest output
  • systemctl status apache2 output
  • journalctl -u apache2 -n 50 output
  • ss -tlnp or lsof -i :80 output (if port conflict)
  • Steps already tried

Does apachectl configtest pass?

Run sudo apachectl configtest. Syntax errors prevent start.

Run `sudo apachectl configtest` (or apache2ctl on Debian). Syntax error: fix the file and line reported, run configtest again. Syntax OK: config is valid—check systemctl status and journalctl for other causes (port, permissions).

You can change your answer later.

Fix config syntax

Edit the config file at the path apachectl configtest reported. Fix missing quotes, unclosed directives, invalid options. Run `sudo apachectl configtest` again. When Syntax OK, run `sudo systemctl start apache2` (or httpd). Confirm you should see the service start.

What does journalctl show?

Read the last 50 lines of Apache logs.

Run `journalctl -u apache2 -n 50` (or -u httpd on RHEL). Address already in use: check ss -tlnp or lsof -i :80; stop conflicting service or change port. Permission denied: chown/chmod for www-data or apache user on config and log dirs. Other: check apachectl configtest and unit file.

You can change your answer later.

Apply fix

Port: stop Nginx or other service using 80/443, or change Listen in Apache config. Permissions: chown www-data:www-data or chmod for config/log dirs. Syntax: fix config per apachectl configtest. Run systemctl start apache2. Confirm you should see active (running).

You can change your answer later.

Done

Apache is active. Monitor with systemctl status apache2.

Test manually or escalate

Run `sudo apachectl -X` (foreground) to see startup errors. Fix config or environment. If managed by config management, escalate with apachectl configtest, systemctl status, and journalctl output.

Reviewed by Blackbox Atlas

Frequently asked questions

Why would Apache not start?
Config syntax error, port already in use, permission denied on config or log dirs, or missing modules. Run apachectl configtest and journalctl first.
Can I fix Apache that will not start myself?
Yes. Run apachectl configtest 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 Apache start failures?
If Apache 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.

Continue to