I am getting lot of unwanted web site traffic to my WordPress web site. It is apache web server on Ubuntu 20.04.
Is there any way to block them.
Please refer the screen shot.log example
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Your web server will respond to every http request, regardless if that request is for valid and existing or invalid and non-existent content. That is unavoidable. ...
One approach to make your logs cleaner and to ensure that only requests using the name of your website will show content from your site by setting up Name Based Virtual hosting.
You do that by setting up at least two VirtualHost entries, one (or more) for your actual site(s) and a default virtual host that will respond to all requests that don't include your site name(s), such as requests made to your IP-address
<VirtualHost *:80> ServerName default DocumentRoot "/www/default" </VirtualHost> <VirtualHost *:80> DocumentRoot "/www/example" ServerName www.example.com ServerAlias example.com # Other directives here </VirtualHost> # additional VirtualHost blocks
You can then use some tricks in the first virtual host declaration to always return an 410 error code rather than (trying to serve) content from an alternate document root by using something along the lines of
<VirtualHost *:80> ServerName default # Don't log requests CustomLog /dev/null common ErrorLog /dev/null # Forces the server to return a 410 Gone status on all requests RewriteEngine On RewriteRule .* - [G] </VirtualHost>