In this tutorial we are going to create block list for our website so that IP addresses that we know are bad can’t connect to our server. Also we are going to protect files that we don’t want to be opened by other people online.
First we edit 000-default.conf and make the needed changes:
<code>pico /etc/apache2/sites-enabled/000-default.conf</code>
Code language: Bash (bash)
<VirtualHost *:80>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ServerName www.webleit.info
ServerAdmin your@mail.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Code language: Apache (apache)
Now we havo to create a .htaccess file and put ip addresses to be blocked and files to be protected:
order allow,deny
deny from 91.247.38.54
deny from 91.247.38.55
deny from 91.247.38.57
deny from 198.15.180.240
deny from 67.229.79.154
deny from 188.120.229.212
deny from 85.128.142.38
allow from all
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>
<Files functions.php>
Order Allow,Deny
Deny from all
</Files>
<Files header.php>
Order Allow,Deny
Deny from all
</Files>
<Files footer.php>
Order Allow,Deny
Deny from all
</Files>
<Files snowstorm.js>
Order Allow,Deny
Deny from all
</Files>
Code language: Apache (apache)