× Presentation and instructions about security tools used to prevent server hacking. Feel free to use them or ask us to protect your site hosting it to a safe, daily monitored vps senter. Freespirits will ensure great quality of services.

Reducing Apache Load by Handling Direct IP and Fake PHP Probes with Nginx

Περισσότερα
6 Ώρες 49 Λεπτά πριν - 6 Ώρες 45 Λεπτά πριν #349 από infogate
Hello everyone,I wanted to share a small but useful server hardening improvement that may help others using CWP / Apache / Nginx reverse proxy setups.Recently, I noticed many automated bot requests hitting the server’s default IP page and trying common fake PHP/webshell filenames such as:
wp-curl-file.php, 1337.php, satan.php, .env, and similar suspicious paths.
Apache was blocking many of them, which was good, but the problem was that the requests were still reaching Apache first. On a busy server, this can waste Apache workers and may contribute to errors like:
server reached MaxRequestWorkers setting
The better approach was to stop these requests earlier at the Nginx level.In my case, the direct IP vhost was controlled by:
/etc/nginx/conf.d/SERVER-IP.conf
I added rules inside the existing server block to return
444
for fake PHP probes and sensitive hidden files, so they are dropped by Nginx before reaching Apache.Example:
location ~* \.(php|phtml|php5|php7|php8)$ {
    return 444;
}

location ~* /\.(env|git|svn|hg|bzr|ht|user\.ini) {
    return 444;
}
After reloading Nginx, tests like these returned an empty reply, which means Nginx blocked them successfully:
curl -I http://SERVER-IP/wp-curl-file.php
curl -I http://SERVER-IP/.env
This is a simple but effective way to reduce useless backend traffic and protect Apache from unnecessary bot noise.Optional extra step: the normal direct IP homepage can also be redirected to the main website by replacing the default
location /
proxy block with:
location / {
    return 301 https://yourdomain.com$request_uri;
}
Of course, always make a backup of the Nginx config file first and test before reloading:
nginx -t
systemctl reload nginx
This small change helped keep malicious probes away from Apache and made the setup cleaner.Hope this helps someone else running CWP with Nginx + Apache.


The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal

Last edit: 6 Ώρες 45 Λεπτά πριν by infogate.

Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.

Χρόνος δημιουργίας σελίδας: 0.074 δευτερόλεπτα
Powered by Kunena Φόρουμ