Apache Allow Specific IP Address on Ubuntu

Apache Allow Spesifik IP Address pada Ubuntu

  • Edit file default virtual host: /etc/apache2/sites-available/000-default.conf
nano /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # Apache Allow Specific IP Address on Ubuntu
        <Directory /var/www/html>
                Order deny,allow
                deny from all
                Allow from 192.168.1.10
        </Directory>
</VirtualHost>
  • Restart service apache
systemctl restart apache2

Pengujian

  • Web server apache hanya bisa di akses dari IP 192.168.1.10
  • Selain dari IP 192.168.1.10 web server apache tidak dapat di akses

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.