Testing the Apache Configuration File - CentOS 7

To test the Apache configuration file, use the "-t" option of the apachectl command.

apachectl -t

If the configuration file is correct, the output will look like this

apachectl -t
Syntax OK

If the configuration file passes the test, can we be sure to reboot?

.

If the configuration file passes the test, it does not guarantee that it will reboot.

We can confirm that it is wrong, but we cannot guarantee that it will reboot.

In my experience, it is often around the SSL settings that the reboot is not possible.

To avoid a disastrous situation, be sure to back up your configuration file with the cp command before making any changes.

cp httpd.conf httpd.conf.20200203

The trick is to make changes to the Apache configuration file one at a time so that you can quickly revert to them. If you change a lot of places and get an error, it will be difficult to identify the cause.

Associated Information