How to check apache syntax error on Linux

In Linux everything is a file. If you don’t know what you are doing, i advise you to don’t do anything because it will leads to damage your server badly. All the software and hardware is a file in Linux and 90% of application working based on .conf file, so if you are going to make any changes on it, make sure you need to check the syntax error to confirm the changes which you made is correct or not. As a server administrator we need to work with apche.conf file very ofter based on our requirement so, i’m listing here possible apache syntax checking commands. If everything is ok you will got “Syntax OK” or detailed information about the particular syntax error.

1) Check Apache Syntax error on CentOS,RHEL,Fedora

You can use the below commands to check the apache syntax error on RPM based systems such as CentOS, RHEL, Fedora, Manjaro, Archi Linux, Oracle Linux & Scientific Linux.

# httpd -t
Syntax OK

# httpd -S
Syntax OK

# httpd configtest
Syntax OK

# apachectl configtest
Syntax OK

2) Check Apache Syntax error on Debian & Ubuntu

You can use the below commands to check the apache syntax error on DEB based systems such as Ubuntu, Debian , openSUSE & Mint.

# apachectl configtest
Syntax OK

# apache2ctl configtest
Syntax OK

# apache2ctl -t
Syntax OK

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...