How to troubleshoot httpd service failing in Linux ?

Today in this post, we will see how to troubleshoot when httpd service is failing in Linux OS.

Lets see step by step process to troubleshoot issues with http/apache service.

 

1. Try to start/restart httpd service.

[root@ngelinux01 conf]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@ngelinux01 conf]#

As we can see our service startup is failing, hence we need to troubleshoot by looking at the logs.

 

2. Check configuration file syntax

[root@ngelinux01 conf]# httpd -f conf/httpd.conf
httpd: Syntax error on line 212 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/00-ssl.conf: Cannot load modules/mod_ssl.so into server: /etc/httpd/modules/mod_ssl.so: cannot open shared object file: No such file or directory

As we can see above, the configuration is not able to find one of the httpd module.

 

3. Install Missing Module

[root@ngelinux01 conf]# yum install mod_ssl
Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify,
: versionlock

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading support for Red Hat kernel ABI
Resolving Dependencies
--> Running transaction check
---> Package mod_ssl.x86_64 1:2.4.6-97.el7_9.5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================
Installing:
mod_ssl x86_64 1:2.4.6-97.el7_9.5 addedrepo 115 k

Transaction Summary
================================================================================================================================
Install 1 Package

Total download size: 115 k
Installed size: 224 k
Is this ok [y/d/N]: y
Downloading packages:
mod_ssl-2.4.6-97.el7_9.5.x86_64.rpm | 115 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:mod_ssl-2.4.6-97.el7_9.5.x86_64 1/1
warning: /etc/httpd/conf.d/ssl.conf created as /etc/httpd/conf.d/ssl.conf.rpmnew
Verifying : 1:mod_ssl-2.4.6-97.el7_9.5.x86_64 1/1

Installed:
mod_ssl.x86_64 1:2.4.6-97.el7_9.5

Complete!

 

4. Try to start service again.

[root@ngelinux01 conf]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

[root@ngelinux01 conf]# httpd -f conf/httpd.conf
httpd: Syntax error on line 212 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/10-fcgid.conf: Cannot load modules/mod_fcgid.so into server: /etc/httpd/modules/mod_fcgid.so: cannot open shared object file: No such file or directory

[root@ngelinux01 conf]# yum install mod_fcgid
Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify,
: versionlock

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading support for Red Hat kernel ABI
Resolving Dependencies
--> Running transaction check
---> Package mod_fcgid.x86_64 0:2.3.9-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================
Installing:
mod_fcgid x86_64 2.3.9-6.el7 base 79 k

Transaction Summary
================================================================================================================================
Install 1 Package

Total download size: 79 k
Installed size: 228 k
Is this ok [y/d/N]: y
Downloading packages:
mod_fcgid-2.3.9-6.el7.x86_64.rpm | 79 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : mod_fcgid-2.3.9-6.el7.x86_64 1/1
Verifying : mod_fcgid-2.3.9-6.el7.x86_64 1/1

Installed:
mod_fcgid.x86_64 0:2.3.9-6.el7

Complete!
[root@ngelinux01 conf]#

Similarly repeat the same process until all modules and all issues reported by the syntax check is corrected.

In the end, when you restart the service, system will start the httpd daemon.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments