[Linux] Restricting folder access using httpd.conf


Writing time : 2016-07-12 00:55:14

Restricting folder access using httpd.conf

If you want to restrict access to phpMyAdmin or the administrator folder to a specific IP, add Directory settings to httpd.conf.

vi /etc/httpd/conf/httpd.conf  

The setting below means that only xxx.xxx.xxx.xxx is allowed for the IP accessing the /var/www/phpMyAdmin folder.

If you access the folder from an IP that has not been set up, an error occurs.

<Directory "/var/www/phpMyAdmin">  
Options FollowSymLinks Multiviews  
AllowOverride None  
Order deny,allow  
Deny from all  
Allow from xxx.xxx.xxx.xxx  
</Directory>  

If you want to allow multiple IPs at the same time, you can use multiple lines of Allow from as shown below.

Allow from 145.50.39.8  
Allow from 145.50.39.9  
Allow from 145.50.39.10  

Refer to the link below for a detailed description of the setting that allows multiple IPs at the same time.

http://stackoverflow.com/questions/10911996/i-want-to-allow-an-ip-range-in-htaccess

Previous post

Other posts in the category