1 / 8

Apache Deny URL Files Directory

Sometimes you may need to restrict access to URL, file or directory. Here is how to deny access to URL, Files & Directory in Apache.<br><br>Visit https://ubiq.co/tech-blog/apache-deny-access-to-url-files-directory/

Download Presentation

Apache Deny URL Files Directory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Apache Deny Access to URL, Files & Directory

  2. Open Apache Configuration File Apache configuration file is located at one of the following locations, depending on your Linux distribution. • /etc/apache2/httpd.conf • /etc/apache2/apache2.conf • /etc/httpd/httpd.conf • /etc/httpd/conf/httpd.conf Open terminal and run the following command to open Apache configuration page. $ sudo vi /etc/httpd/conf/httpd.conf

  3. Restrict Access by IP (⅓) Let us assume you want to limit access to /product.html URL by IP 45.34.21.10. Once you have opened the appropriate configuration file, look for <Location> tag for the above URL. Apache provides Deny directive to block one or more IP addresses. Add the following line in Location tag Deny 45.34.21.10

  4. Restrict Access by IP (⅔) If you want to block IP from accessing a specific directory such as /admin, then add the above Deny directive location block of /admin subfolder. <Location /admin> ... Deny 45.34.21.10 ... </Location>

  5. Restrict Access by IP (3/3) If you want to block IP from accessing a specific file such as /var/www/html/input.html, then add the above Deny directive in Directory block of input.html file. <Directory /var/www/html/input.html> ... Deny 45.34.21.10 ... </Directory>

  6. Apache Limit Access by multiple IP If you want to limit access to multiple IPs, add separate Deny directives for each IP. In the following example, we limit access to IPs 45.34.21.10 and 65.34.23.12 <Location /product.html > ... Deny 45.34.21.10 Deny 65.34.23.12 ... </Location>

  7. Restart Apache web server Restart Apache web server to apply changes. # service httpd restart OR # systemctl restart httpd OR # sudo service apache2 restart

  8. Thank You Visit for details https://ubiq.co/tech-blog/apache-deny-access-to-url-files-directory/

More Related