Check: http://httpd.apache.org/docs/2.2/programs/apachectl.html

apachectl configtest
Answer from keatch on serverfault.com
🌐
Hexmos
hexmos.com › freedevtools › c › cmd › apachectl
Apachectl Config Test - Validate Apache Configuration Syntax Cheatsheet | cmd Reference | Online Free DevTools
Validate Apache configuration syntax with apachectl configtest. This command checks your httpd.conf and other configuration files for errors. The apachectl command is a powerful utility for managing and testing Apache HTTP Server configurations.
Discussions

apache2.4 - How do I test httpd.conf on my Windows? - Stack Overflow
Different websites give me different answers to this question, but I think they area all for linux. http://httpd.apache.org/docs/2.2/programs/apachectl.html gives me a useful tool, but this cannot be used on my command prompt (picture below). More on stackoverflow.com
🌐 stackoverflow.com
Apache config test and send signal to restart apache if syntax check is passed - Ansible Project - Ansible
Hi, I’m trying to run two commands in a single line, which will validate the syntax of apache configuration copied from template file and send a signal to reload the apache if it’s passed. Right now, my configuration looks like as below where I only sending the signal to apache to reload ... More on forum.ansible.com
🌐 forum.ansible.com
0
December 11, 2018
rhel - How do I check the apache config for validity in Red Hat Linux? - Stack Overflow
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... # More on stackoverflow.com
🌐 stackoverflow.com
"Unit Tests" for Apache configuration?
I wouldn't consider it a "unit" test, but could you have script that spins Apache up in a container and then point Selenium at it? More on reddit.com
🌐 r/devops
9
15
March 13, 2019
🌐
GFI
manuals.gfi.com › en › exinda › help › content › exos › how-to-guides › ssl-accel › apache › apache-test.htm
Verify the secure server configuration - GFI Support
Settings > Optimization services > Protocol-specific Acceleration > Test the changes to the Apache configuration files · It is always best to check your Apache config files for any errors before restarting, because Apache will not start again if your config files have syntax errors. Check the Apache config files for errors, run the following command:
Top answer
1 of 3
9

What is the equivalent of apachectl configtest on Apache for Windows?

According to the current Apache 2.4 documentation for apachectl, configtest is equivalent to httpd -t. For reference, httpd -t allows you to:

Run syntax tests for configuration files only. The program immediately exits after these syntax parsing tests with either a return code of 0 (Syntax OK) or return code not equal to 0 (Syntax Error). If -D DUMP_VHOSTS is also set, details of the virtual host configuration will be printed. If -D DUMP_MODULES is set, all loaded modules will be printed.

Configuration errors for both httpd.conf and any virtual host files will also typically be caught with a manual, non-service manager service start-up (httpd -k start) ex.

You will need to stop any running Apache service before attempting httpd -k start (httpd -t should have no such requirement).


Note that while the question is in regards to Apache 2.2, the general documentation for apachectl configtest and httpd -t hasn't changed between versions 2.2. and 2.4.


I have Apache 2.2 for Windows installed on my laptop.

As of this writing, Apache 2.2 is officially End-of-Life. As of January 1st, 2018:

Apache HTTP Server Project has discontinued all development and patch review of the 2.2.x series of releases [...] and no further evaluation of security risks will be published for 2.2.x releases.

If you don't have a compelling reason to stick with version 2.2 (ex. it's for personal use and you don't need some specialized module(s), etc.), you may want to seriously consider upgrading.

I would recommend the native (non-Cygwin) Windows builds from Apache Lounge. They generally keep pace with the latest official Apache Foundation releases (or aren't far behind) and have a decent selection of common optional modules.

(As a small side note, upgrading from version 2.2 to 2.4 will require some small syntax changes in your configuration files but nothing major).

2 of 3
2

While this doesn't really answer my configtest question, I was able to determine why httpd won't start by looking in:

c:\Apache2.2\logs\error.log

There were many repitions of:

 (OS 3)The system cannot find the path specified.  : httpd.exe: could not open error log file C:/cygwin64/home/Thunderball/_Websites/Soggy/logs/error.log.
 Unable to open logs

Going back to cygwin I got the bad news that all but one of the folders in my home directory no longer exist!

Sucks to be me. :-(

I recently got the idea that my Acer's hard drive was failing. I can't find anything in my history that would have accidentally blown all of my data away.

Perhaps Right Now would be a good time to stop using my Acer. I'm mostly OK as I have good backups, and a Mac mini at home. I can't buy a replacement drive until I complete my project for my current contract. Until then I'm going to be a little short of cash.

I'm mostly happy with my Acer Aspire E 15, so I will replace its drive, mostly likely with an SSD, as well as its screen which is badly scratched.

🌐
Debian Manpages
manpages.debian.org › testing › apache2 › apache2ctl(8)
apache2ctl(8) — apache2 — Debian testing — Debian Manpages
May 5, 2026 - Restarts the Apache daemon by sending it a SIGHUP. If the daemon is not running, it is started. This command automatically checks the configuration files via configtest before initiating the restart to to catch the most obvious errors.
🌐
Apache Software Foundation
httpd.apache.org › docs › 2.4 › programs › apachectl.html
apachectl - Apache HTTP Server Control Interface - Apache HTTP Server Version 2.4
Run a configuration file syntax test. It parses the configuration files and either reports Syntax Ok or detailed information about the particular syntax error.
🌐
ServerCake
servercake.blog › home › how to test the apache configuration httpd.conf file in linux
How to test the apache configuration httpd.conf file in linux - ServerCake
December 12, 2017 - So whenever the changes are made in httpd.conf file, it is recommended to test the apache config file. ... apachectl is the front end of the Apache Server i.e Apache Http protocol, this apachectl is designed to control the Apache server functioning. When you run the above command in your Linux terminal that will check for the errors in apache server configuration file and its validity.
Find elsewhere
🌐
Acunetix
acunetix.com › home › web security blog › troubleshooting tips for apache, part 1 – verifying apache http server configuration and version
Troubleshooting Apache: Verifying Apache HTTP Server Configuration
January 9, 2024 - For Apache on Unix systems you would need to execute apachectl –configtest from the command line and for Apache on Windows systems you would need to first navigate to the Apache ‘bin’ directory from the command line and then execute httpd.exe ...
🌐
Simplified
simplified.guide › apache › config-test
How to test Apache configuration
Run the Apache syntax test before applying the change. $ sudo apache2ctl configtest AH00526: Syntax error on line 1 of /etc/apache2/conf-enabled/zz-broken.conf: Invalid command 'ServerNmae', perhaps misspelled or defined by a module not included in the server configuration
🌐
Thisprogrammingthing
thisprogrammingthing.com › 2016 › Test-Your-Apache-Config
Test Your Apache Config - This Programming Thing
March 2, 2016 - $ sudo apachectl configtest Syntax error on line 4 of /etc/apache2/sites-enabled/000-default: Invalid command 'DaocumentRoot', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed.
🌐
Config Server Firewall
configserverfirewall.com › linux-tutorials › apachectl-command
Using apachectl to Control Apache Web Server in Linux
The configtest command will cause Apache to read the config files and report any configuration errors.
🌐
Seowebchecker
seowebchecker.com › home › testing tools › apache config tester
Apache Config Tester – Verify Apache Config Online
Run apachectl configtest or apache2ctl -t on the server. The command performs a syntax check and reports errors with line numbers. Our online tester offers the same convenience from any browser, with no SSH access required.
🌐
Ansible
forum.ansible.com › archives › ansible project
Apache config test and send signal to restart apache if syntax check is passed - Ansible Project - Ansible
December 11, 2018 - Hi, I’m trying to run two commands in a single line, which will validate the syntax of apache configuration copied from template file and send a signal to reload the apache if it’s passed. Right now, my configuration looks like as below where I only sending the signal to apache to reload after coping the config from template file and it’s working fine. command: ‘-consul={{ ansible_host }}:2250 -template=“vhosts.ctmpl:vhosts.conf:/bin/docker/docker kill -s USR1 apache”’ But I’m trying to add ...
🌐
Ubuntu
manpages.ubuntu.com › manpages › trusty › man8 › apache2ctl.8.html
Ubuntu Manpage: apache2ctl - Apache HTTP server control interface
Gives an error if it is already ... the daemon is not running, it is started. This command automatically checks the configuration files via configtest before initiating the restart to to catch the most obvious errors....
🌐
Tech Recipes
tech-recipes.com › home › http › apache web server › test the apache configuration file httpd.conf
Test the Apache Configuration File httpd.conf - Tech Recipes
March 26, 2012 - After making changes to the Apache configuration file, testing the configuration before implementing it is a good practice. To test the Apache configuration file for errors, use the following command: apachectl configtest If the configuration file is fine, this command will return Syntax Ok. ...
🌐
Marco
marco.maranao.ca › articles › apache-configuration-test
Apache Configuration Test | Marco
April 7, 2020 - Mac OSX apachectl configtest XAMPP OSX /Applications/XAMPP/xamppfiles/bin/apachectl configtest Errors should display, if there are any, otherwise you'll see the Syntax OK to indicate that there are no errors and you can reload the apache config file or restart apache.