在ubutnu server下
sudo vim /etc/apache2/apache2.conf
(在centos下是vim /etc/httpd/conf/httpd.conf)
找到網站目錄,例如:網站目錄是在/var/www資料夾中
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
apache 2.4加入:
Require all denied
Require all granted
Require host xxx.com
Require ip 192.168.1 192.168.2
Require local
apache2.2加入:
Deny from all
Allow from 163.20.
Allow from 10.
變成
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 10.
Allow from 163.20.
</Directory>
或是
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all denied
Require ip 10.0.0.0/8 163.20.xx.0/24
Require host xxx.ntpc.edu.tw
</Directory>Require ip 10.0.0.0/8 163.20.xx.0/24
Require host xxx.ntpc.edu.tw
重新啟動apache
sudo /etc/init.d/apache2 restart
沒有留言:
張貼留言