wtf I have to create this to find the error.
- LOG ERRORS!!
- START EVERYTHING THAT IS GOOD AND JUST FAIL THE VHOST!!!!!
#!/bin/bash
CONF="/etc/httpd/conf.d"
TRY="$CONF/try"
ERROR_LOG="/var/log/httpd/error_log"
GOOD=(
"autoindex.conf"
"httpd-custom.conf"
"httpd-defines.conf"
"mod_security.conf"
"php82-php.conf"
"php74-php.conf"
"php.conf"
"ssl.conf"
"userdir.conf"
"welcome.conf"
)
FAILED=()
echo "=== Restoring known-good configs ==="
for f in "${GOOD[@]}"; do
if [ -f "$TRY/$f" ]; then
echo " restoring: $f"
mv "$TRY/$f" "$CONF/"
fi
done
echo
echo "=== Testing known-good baseline ==="
if ! httpd -t; then
echo "ERROR: baseline configuration failed"
exit 1
fi
if ! systemctl restart httpd; then
echo "ERROR: Apache failed with known-good configuration"
tail -100 "$ERROR_LOG"
exit 1
fi
echo "Baseline OK."
echo
echo "=== Testing domains ==="
for f in "$TRY"/*.conf; do
[ -f "$f" ] || continue
name=$(basename "$f")
echo
echo "=========================================="
echo "Testing: $name"
echo "=========================================="
mv "$f" "$CONF/$name"
if ! httpd -t; then
echo "!!! SYNTAX FAILURE: $name !!!"
FAILED+=("$name")
mv "$CONF/$name" "$TRY/$name"
continue
fi
if systemctl restart httpd && systemctl is-active --quiet httpd; then
echo ">>> OK: $name"
continue
fi
echo
echo "##########################################"
echo "FAILED: $name"
echo "##########################################"
echo
echo "--- Apache error_log ---"
tail -100 "$ERROR_LOG"
FAILED+=("$name")
# Remove bad config
mv "$CONF/$name" "$TRY/$name"
echo
echo "Restoring Apache without $name..."
if systemctl restart httpd && systemctl is-active --quiet httpd; then
echo "Apache restored."
else
echo "WARNING: Apache could not be restored!"
echo "Stopping tests."
exit 1
fi
# Continue with next domain
done
echo
echo "=========================================="
echo "TEST COMPLETE"
echo "=========================================="
if [ ${#FAILED[@]} -eq 0 ]; then
echo "All domains passed."
else
echo "Failed configurations:"
for name in "${FAILED[@]}"; do
echo " $name"
done
fi
>
> I know already I have somewhere some crt not auto renewed with this
> crappy 90 days life time and all cloud ips being blocked because of
> wordpress abuse scans. wtf is apache not reporting correctly!