It's a pain to get a configuration error when restarting your
Apache service and the service just wouldn't start; even more so in a production environment. It's always a good idea to test the validity of your newly updated
Apache config file before restarting the service.
You can use both
httpd to test your
Apacheconfiguration file using your preferred text editor.
$ sudo vi /etc/apache2/apache2.conf
$ sudo apachectl configtest AH00543: apache2: bad user name username Action 'configtest' failed. The Apache error log may have more information.
-t option instead of
configtest if you're using
apache and not
Apacheconfiguration until no error is reported by the
$ sudo apachectl configtest Syntax OK
Apacheservice for the changes to take effect.
$ sudo systemctl restart apache2 # Ubuntu, Debian, openSUSE and SLES $ sudo systemctl restart httpd # CentOS and Red Hat
Comment anonymously. Login not required.