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

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

# 一个WEB目录
# 禁止以IP地址形式访问
<VirtualHost 192.168.8.129> ServerName 192.168.8.129 <Location /> Order Allow,Deny Deny from all </Location> </VirtualHost>
# 允许通过域名形式访问,指定路径 <VirtualHost 192.168.8.129> DocumentRoot /var/www/html/nav.jackcui.com/ ServerName nav.jackcui.com </VirtualHost>
# 多个虚拟目录
# 禁止以IP地址形式访问
<VirtualHost 192.168.8.129> ServerName 192.168.8.129 <Location /> Order Allow,Deny Deny from all </Location> </VirtualHost> # 允许通过域名形式访问,多个虚拟指定路径
<VirtualHost 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
<Directory /usr/share/ldap-account-manager> Options +FollowSymLinks AllowOverride All Require all granted DirectoryIndex index.html </Directory>

<Directory /var/lib/ldap-account-manager/tmp> Options -Indexes </Directory>
<Directory /var/lib/ldap-account-manager/tmp/internal> Options -Indexes Require all denied </Directory>
<Directory /var/lib/ldap-account-manager/sess> Options -Indexes Require all denied </Directory>
<Directory /var/lib/ldap-account-manager/config> Options -Indexes Require all denied </Directory>
<Directory /usr/share/ldap-account-manager/lib> Options -Indexes Require all denied </Directory>
<Directory /usr/share/ldap-account-manager/help> Options -Indexes Require all denied </Directory>
<Directory /usr/share/ldap-account-manager/locale> Options -Indexes Require all denied </Directory> <Directory /usr/share/phpldapadmin/htdocs> <IfModule mod_authz_core.c> # Apache 2.4 Require all granted </IfModule>
#
<IfModule !mod_authz_core.c> # Apache 2.2 # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> </Directory>
ServerName ldap.jackcui.com
</VirtualHost>

 

转载于:https://www.cnblogs.com/jackcui/p/11489100.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值