arnoldbird
arnoldbird

Reputation: 954

How do I check the apache config for validity in Red Hat Linux?

My operating system is Red Hat Enterprise Linux 7. This isn't working...

# httpd -t
bash: httpd: command not found

In case it helps, this is the command I run to restart apache on this box...

# systemctl restart httpd24-httpd

But this doesn't work...

# httpd24-httpd -t
bash: httpd24-httpd: command not found

This doesn't work either...

# apachectl -t
bash: apachetl: command not found

Nor does this work...

# apachectl configtest
bash: apachetl: command not found

Upvotes: 1

Views: 4180

Answers (1)

Dan
Dan

Reputation: 36

I know this is a couple months old but ended up here. I ran into the same issue initially, hence why I am here. I found that the location for the new httpd24-httpd wasn't in my env path to execute. While I could added it there, I found the command location and was able to execute.

How I found the command:

sudo find / -name apachectl

The output of the command:

/opt/rh/httpd24/root/usr/sbin/apachectl

Executed the command:

sudo /opt/rh/httpd24/root/usr/sbin/apachectl

Turns out I have to fix my configuration.

httpd: Syntax error on line 56 of /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf: Syntax error on line 40 of /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-base.conf: Cannot load modules/mod_http2.so into server: libnghttp2-httpd24.so.14: cannot open shared object file: No such file or directory

Interesting that this came up for me, as I've not done anything with the configuration in this regard.

Here's the version I am running.

sudo /opt/rh/httpd24/root/usr/sbin/apachectl -v

Server version: Apache/2.4.34 (Red Hat) Server built: Mar 17 2020 09:34:59

All the best!

Found something more for this as well from an old bug submitted to Redhat

Bug 1329639

Comment 10

scl enable httpd24 -- /opt/rh/httpd24/root/usr/sbin/apachectl configtest

Upvotes: 2

Related Questions