Httpd troubleshoot
Troubleshooting httpd
startup issues in Linux can be a process of elimination. Here are some common steps to diagnose and resolve problems:
1. Check the Service Status
Run:
systemctl status httpd
Or, if using an older system:
service httpd status
This will show whether the service is running, stopped, or if there’s an error.
2. Examine the Logs
Check the logs for errors:
journalctl -u httpd --no-pager | tail -20
Or look at Apache's error log:
cat /var/log/httpd/error_log | tail -20
This will help pinpoint configuration issues.
3. Verify Syntax of Config Files
Run:
apachectl configtest
Or:
httpd -t
If there are syntax errors in httpd.conf
or any included files, this will highlight them.
4. Check for Port Conflicts
Ensure no other process is using port 80 or 443:
netstat -tulnp | grep httpd
Or:
ss -tulnp | grep httpd
If another process is interfering, you'll need to resolve the conflict.
5. Check Firewall and SELinux
Make sure the firewall allows HTTP traffic:
firewall-cmd --list-services
To allow HTTP:
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
If SELinux is enabled, check its status:
sestatus
You may need to adjust its policies.
6. Restart the Service
After fixing issues, restart:
systemctl restart httpd
Then confirm it's active:
systemctl status httpd
Does any error message stand out in your logs?