# systemd: apache2.service: Main process exited, code=exited, status=1/FAILURE — Job for apache2.service failed because the control process exited with error code

**Code:** `apache2.service: Failed with result 'exit-code'` · **Category:** Nginx / Apache · **Seen on:** Apache, Linux

systemd couldn't start Apache — the real error is in the journal or `apachectl configtest`.

## Meaning

Run `sudo apachectl configtest` and `sudo journalctl -xeu apache2` (or `httpd` on RHEL). Typical reasons: syntax error, port in use (AH00072), missing log directory (AH00015), missing module/cert file, or SELinux denial.

## Common causes

- Config syntax error
- Port already in use
- Missing SSL certificate/key files
- Log directory problems
- SELinux/AppArmor denial

## Quick fix

1. `sudo apachectl configtest`
2. `sudo journalctl -xeu apache2 --no-pager | tail -50`
3. Fix the reported AH code and restart

## Detailed fix by platform

### Linux

1. `sudo apachectl configtest; sudo journalctl -xeu apache2 --no-pager | tail -40`

## How to diagnose

1. **Test** — configtest output?
2. **Journal** — AH code?
3. **Port** — Free?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nginx-apache/apache-service-failed-exit-code-systemd)
