Would you like to learn how to install Apache and deny access to an IP address list? In this tutorial, we are going to configure the Apache server to block the access from an IP address list.
• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• Apache 2.4.41
Copyright © 2018-2021 by Techexpert.tips.
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the publisher.
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Apache – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Apache.
Tutorial Apache – Blocking an IP address list
Install the Apache server.
Enable the required Apache modules.
Edit the Apache configuration file for the default website.
Add the following lines to this configuration file.
Here is the file, before our configuration.
Here is the file, after our configuration.
Create a file containing the list of IP addresses.
Here is the file content.
Configure the file permission.
Restart the Apache service.
In our example, the Apache server will forbid access from IP addresses included on the file named BLACKLIST.
From a computer included on the list, open the browser and enter the IP address of your web server.
In our example, the following URL was entered in the Browser:
• http://192.168.2.110
The Apache server will deny access and display an error message.
Congratulations! You created an IP-based access-list on the Apache server.
Tutorial Apache – Blocking an IP address network
Install the Apache server.
Enable the required Apache modules.
Edit the Apache configuration file for the default website.
Add the following lines to this configuration file.
Here is the file, before our configuration.
Here is the file, after our configuration.
Create a file containing the list of IP addresses.
Here is the file content.
Configure the file permission.
Restart the Apache service.
In our example, the Apache server will forbid access from IP addresses included on the file named BLACKLIST.
In our example, we blocked the entire network 192.168.10.0/24.
In our example, we blocked the entire network 192.168.20.0/24.
From a computer included on the list, open the browser and enter the IP address of your web server.
In our example, the following URL was entered in the Browser:
• http://192.168.2.110
The Apache server will deny access and display an error message.
Congratulations! You created an IP-based access-list on the Apache server.