This PR fixes the Apache config test hanging for about 20 seconds when the server's own hostname doesn't resolve.
Without a global `ServerName`, Apache looks up the system hostname in DNS before it finishes the test, and Virtualmin runs this test every time its server list and dashboard load, so those pages look frozen.
The test now passes a placeholder `ServerName` with `-C` and runs `httpd` directly where Red Hat's `apachectl` refuses extra arguments. If this quick test fails, the original test runs, so only real config errors are reported.
On an Alma 10 VM with broken DNS, the check dropped from 20 seconds to 0.03 seconds.
This patch fixes comments before skipped `IfModule`, `IfDefine`, and `IfVersion` blocks being attached to the next parsed directive.
For example:
```apache
# SSL-only settings
<IfModule mod_ssl.c>
SSLEngine on
</IfModule>
ServerName example.test
```
When `mod_ssl` was unavailable, Webmin attached `# SSL-only settings` to `ServerName`. Deleting `ServerName` could then remove the wrong line and produce:
```apache
# SSL-only settings
<IfModule mod_ssl.c>
SSLEngine on
```
This fix clears comments belonging to skipped conditionals. Deleting `ServerName` now leaves the complete `IfModule` block unchanged.
This PR fixes incorrect line numbers when Apache directives contain nested blocks.
It preserves comments during rewrites and correctly tracks every nested line.
This prevents Virtualmin from corrupting custom Apache configurations.
Fixes: https://github.com/virtualmin/virtualmin-gpl/issues/1153
* Note: Bring the Apache module to parity with the Nginx module's Debian
sites-available/sites-enabled handling: list disabled vhost files
alongside active ones, toggle their state via symlink with apachectl
configtest rollback, and delete VirtualHost blocks from inactive files.
When Virtualmin manages a vhost, defer enable/disable to Virtualmin's
own forms instead of touching the symlink directly.
https://forum.virtualmin.com/t/enable-disable-toggle-buttons-in-ngnix-module/137238/4?u=ilia