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 ::
# </IfModule>
</Directory>
ServerName ldap.jackcui.com
</VirtualHost>
Centos7.6 Apache 虚拟机禁止访问IP,允许访问多域名多个虚拟目录设置的更多相关文章
- Apache下禁止使用IP直接访问本站的配置方法
现在管的严啊,上面要求不能使用IP直接访问服务器,把apache配置做下调整就行了.方法如下: 打开apache的配置文件 # vi /usr/local/apache2/conf/extra/htt ...
- PHP禁止同一IP频繁访问以防止网站被防攻击或采集的代码
PHP禁止同一IP频繁访问以防止网站被防攻击或采集的代码 <?php /* *通过禁止IP频繁访问防止网站被防攻击代码*design by www.scutephp.com*/header('C ...
- Apache localhost和局域网ip地址访问
今天忍无可忍重装了公司的电脑,所以把开发工具也都重新装一下. 安装wamp,localhost和局域网ip地址无法访问. 在C:\Windows\System32\drivers\etc\hosts文 ...
- APACHE 禁止通过IP直接访问
若是开通了虚拟主机,则需要在httpd-vhosts.conf中修改配置如下:若没有开通虚拟主机,则可以直接在httpd.conf文件最后面,加入以下代码: NameVirtualHost XXX.X ...
- 虚拟机如何固定ip并访问外网?!
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNor ...
- tomcat 访问IP直接访问项目
apache-tomcat-7.0.52\conf下server.xml文件 <Connector connectionTimeout="20000" port=" ...
- vue项目localhost可以访问 ip不能访问
解决方法: 如图所示:
- jsp 访问文件夹中的图片,tomcat配置虚拟目录
1.配置hosts文件 找到C:\Windows\System32\drivers\etc\hosts.txt 文件 添加127.0.0.1 www.image.com 在dos 命令中执行 pi ...
- apache虚拟目录设置
<VirtualHost *:80> DocumentRoot "/xampp/htdocs/f" ServerName f.e-elitech.net</Vir ...
随机推荐
- 创建mysql索引的方式
创建索引方式: 1.create index 索引名 on 表名 (字段) 2.alter table 表 add index 索引名 (字段) -- 普通索引 alter table 表名 ...
- C#通过反射调用类及方法
反射有个典型的应用,就是菜单的动态加载,原理就是通过反射调用某个窗体(类).下面演示一下通过反射调用类及方法: 1.新建一个类,命名为:ReflectionHelper,代码如下: #region 创 ...
- Linux - CentOS 7 安装 .Net Core 运行环境
阿里云的CentOS 7.7 64位,所需要的环境:MySql 5.7,.Net Core 2.2 ,Nginx 我这里用的 Xshell 工具,首先用root进入系统 版本信息 打开终端输入命令: ...
- NLTK实现文本切分
之前已经了解了使用nltk库,将文本作为参数传入相应函数进行切分的方法,下面看看使用正则表达式如何来进行文本切分. 1. 使用正则表达式切分 1.1 通过RegexpTokenizer 进行切分.先导 ...
- js Set对象
1.将数组转换成Set对象 let arr1 = new Set([1,2,3,4]) console.log(arr1) //{1,2,3,4} 2.数组去重 let arr2 = new Set( ...
- 45.QT-连接外部dll,lib库导入问题
dll库问题 查看MZ_Card.dll对应的文档手册,如下图所示: 所以代码写为: typedef BOOL (*Fun)(BOOL IsOpenComm,unsigned long Port, u ...
- Android WebView与H5联调技巧
版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/78 背景: 突然想写一篇关于Android WebView ...
- git 进行版本打标签
一般给生产环境的代码新包进行打标签,以便查找,发布正式环境的各个不同版本作用,简单来说,就是给包命名,容易区分太多版本啦 获取系统中的所有标签或筛选特定特征的标签 git tag -a tagname ...
- VirtualBox中重建Host-Only网卡后无法启动虚拟机
问题: 在删除原有VirtualBox Host-Only虚拟网卡并重新添加后,虚拟机可能会无法启动,出现以下错误 Failed to open/create the internal network ...
- Python常用的正则表达式处理函数
Python常用的正则表达式处理函数 正则表达式是一个特殊的字符序列,用于简洁表达一组字符串特征,检查一个字符串是否与某种模式匹配,使用起来十分方便. 在Python中,我们通过调用re库来使用re模 ...