apache单ip多域名多目录配置
自己的vps上放了别人的网站,那怎么样让自己的网站和别人的网站能同时被访问呢?需要使用apache的虚拟主机配置。
配置httpd.conf文件
比如原来是这种只是指向一个目录的配置
DocumentRoot "/opt/lampp/htdocs/ppe112"
<Directory "/opt/lampp/htdocs/ppe112">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes #
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All #
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
把这段话变成
<VirtualHost 198.199..XXX> #这里填主机的ip地址
ServerName www.AAA.com
DocumentRoot "/opt/lampp/htdocs/AAA"
<Directory "/opt/lampp/htdocs/AAA">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes #
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All #
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
</VirtualHost> <VirtualHost 198.199..XXX> #这里填主机的ip地址
ServerName www.BBB.com
DocumentRoot "/opt/lampp/htdocs/BBB"
<Directory "/opt/lampp/htdocs/BBB">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes #
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All #
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
</VirtualHost>
这样就实现了AAA网站和BBB网站同时在服务器上共存,外部两个域名指向同一个ip,内部解析到不同服务器目录的操作。
PS:这里这里只能正常访问www.AAA.com www.BBB.com这两个,如果要直接访问AAA.com BBB.com 也需要如上再配置一遍。
apache单ip多域名多目录配置的更多相关文章
- apache一个IP多个站点的配置方法
在日常的网站发布中很多情况下都无法做到一个IP对应一个站点,在IP4的情况下IP的资源是相对有限的.然而作为最流行的Apache自然也考虑到这种情况,那么接下来看看apache服务器怎么配置一个IP多 ...
- 关于apache下同IP多域名支持HTTPS和80跳转HTTPS的配置
httpd-ssl的配置: Listen 443 NameVirtualHost *:443 AddType application/x-x509-ca-cert .crt AddType appli ...
- apache单ip配置多端口多站点
1.修改 /etc/httpd/conf/httpd.conf 添加一个Listen,如: Listen 80 Listen 8001 Listen 8002 2.添加一个VirtualHost #v ...
- nginx分区域名转发 tp5域名分目录配置
需求 本来我们一般情况下都是域名abc.com解析到网站的根目录/root/public这种.但是客户突然提出了一个奇葩的需求,客户要求以后可能网站会增多,需要增加分区的功能,比如abc.com/wh ...
- [环境配置] 如何为Apache绑定多IP多域名
在Apache服务器上绑定方法比较简单,主要因为Apache是个开源独立的服务器软件,而且支持跨平台安装和配置,支持丰富的API扩展,所以很多人对Apache的好感要甚于IIS,Apache的优点就不 ...
- apache虚拟目录配置实例
apache虚拟目录配置实例 一.首先,开启虚拟主机配置 在文件httpd.conf中找到: include conf/extra/httpd-vhosts.conf #开启 二.对httpd-vho ...
- wamp多网站配置for window 本地测试 单Ip
网上有很多WAMP集成环境下单IP多域名虚拟主机配置的文章,自己总结了有用方法记录下来 简单的介绍一下我的系统环境:window xp 和 wamp apache2.2.8 ------------ ...
- linux apache虚拟主机配置(基于ip,端口,域名)
配置环境: linux版本:Centos6.4 httpd版本: [root@centos64Study init.d]# pwd/etc/init.d[root@centos64Study init ...
- centos7 Apache 2.4.6 多域名多网站配置
Apache 2.4.6 多域名多网站配置 在/etc/httpd/conf 下 编辑 vim httpd.conf 添加:ServerName 外网IP 并注释 #DocumentRoot &quo ...
随机推荐
- Nexus搭建Maven私有仓库
原文:http://blog.csdn.net/rickyit/article/details/54927101 前言 Nexus Repository Manager is a Javaapplic ...
- 使用datatables实现后台分页功能,减轻前端渲染压力
注意不同版本,参数名字及参数内容存在差异,具体可以参考https://datatables.net/upgrade/1.10-convert#Options 控制页面显示的参数:https://dat ...
- javascript闭包诡异的问题
var funcs = []; for (var i = 0; i < 3; i++) { // let's create 3 functions funcs[i] = function() { ...
- CF 234 C Weather(粗暴方法)
C. Color Stripe time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- 软件质量之道:PCLint之中的一个
故天将降大任于斯人也,必先苦其心志,劳其筋骨,饿其体肤,空乏其身,行拂乱其所为,所以动心忍性,增益其所不能. 孟子 1引子 今天听老韩一席话,当真是感慨万千啊.心怀斗志昂扬.奋斗十年,到头来.却看到身 ...
- IPython与Jupyter notebook 安装与配置,插件扩展,主题,PDF输出
基于 python2.7.13 32-bit版本安装 1.安装pyreadline https://pypi.python.org/pypi/pyreadline 下载对应的32位版本 安装Micro ...
- Leetcode Single Number II (面试题推荐)
还记得<剑指offer>和<编程之美>等书上多次出现的找一个数组中仅仅出现一次的数那个题吗? leetcode也有这道题 链接here 相信大家都知道用异或在O(n)的时间复 ...
- dm385的分辨率切换
建议用两个RSZ的输出来完成切换分辨率功能,帧率可以通过软件丢帧来实现. 两个SWMS增加了两个1080p60的读和写,对系统影响是比较大的. http://www.deyisupport.com/q ...
- Android 4.4.2 动态加入JNI库方法记录 (二 app应用层)
欢迎转载,务必注明出处:http://blog.csdn.net/wang_shuai_ww/article/details/44458553 源代码下载地址:http://download.csdn ...
- (原创)EasyUI中datagrid的行编辑模式中,找到特定的Editor,并为其添加事件
有时候在行编辑的时候,一个编辑框的值要根据其它编辑框的值进行变化,那么可以通过在开启编辑时,找到特定的Editor,为其添加事件 // 绑定事件, index为当前编辑行 var editors = ...