Latest "Apache" files
Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » Apache

Detect SYN flood slowing down server with netstat

If the web server is slow, detect a SYN flood by netstat -ant | grep :443 | grep SYN_RECV to show the IP addresses leaving it hanging. Hint: If you're behind a reverse proxy, and that shows IP addresses that aren't the proxy's, then your IP is being hit directly. To find out how many IPs are hanging, do netstat -ant | grep :443 | grep SYN_RECV | wc -l. If you do it a few times and the number is increasing, you may be under attack. If it's over 100, that's suspicious, but manageable and the server can usually handle it, especially if you have SYN cookies activated. If it's over 1000, you're under attack.

Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » Apache

Add /fpm-status page to Apache virtual host

Add this to virtual host file in /etc/apache2/sites-available/, right below DocumentRoot, in both :80 and :443 sections



SetHandler "proxy:unix:/var/php-fpm/170027027353667.sock|fcgi://127.0.0.1"
Require all granted

May need in /etc/php/8.2/fpm/pool.d/www.conf, not sure:
pm.status_path = /fpm-status

May need at very start of .htaccess to prevent wordpress from intercepting the URL, not sure:
RewriteRule ^fpm-status$ - [L]

Workshop » Reference Section » Grimoires » IT » Platforms » Linux » Packages » Apache

View last 200 lines of all access logs on apache server

find [path/to/access/logs/folder] -name "*_access_log" -exec sh -c 'tail -200 "$1" | grep -v "HetrixTools\|ok\.txt\|canary" | sed "s/$/ [$(basename "$1" _access_log)]/"' _ {} \; | sort -k4,4

The grep -v "HetrixTools\|ok\.txt\|canary" filters out hits from my uptime monitor.