Centos7.6 Apache 虚拟机禁止访问IP,允许访问多域名多个虚拟目录设置

存放配置文件路径 /etc/httpd/conf.d
自定义命名,配置文件后缀格式确保 *.conf
注:这是两个配置文件,也是两种方法。

# 一个WEB目录
# 禁止以IP地址形式访问
192.168.8.129> ServerName 192.168.8.129 Order Allow,Deny Deny from all
# 允许通过域名形式访问,指定路径 192.168.8.129> DocumentRoot /var/www/html/nav.jackcui.com/ ServerName nav.jackcui.com
# 多个虚拟目录
# 禁止以IP地址形式访问
192.168.8.129> ServerName 192.168.8.129 Order Allow,Deny Deny from all # 允许通过域名形式访问,多个虚拟指定路径
192.168.8.129> Alias /lam /usr/share/ldap-account-manager Alias /phpldapadmin /usr/share/phpldapadmin/htdocs Alias /ldapadmin /usr/share/phpldapadmin/htdocs Alias /pwd /var/www/html
Options +FollowSymLinks AllowOverride All Require all granted DirectoryIndex index.html
Options -Indexes
Options -Indexes Require all denied
Options -Indexes Require all denied
Options -Indexes Require all denied
Options -Indexes Require all denied
Options -Indexes Require all denied
Options -Indexes Require all denied # Apache 2.4 Require all granted
#
# Apache 2.2 # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # Allow from ::1 #

ServerName ldap.jackcui.com

 

你可能感兴趣的:(Centos7.6 Apache 虚拟机禁止访问IP,允许访问多域名多个虚拟目录设置)