最近弄了台香港服务器做测试,Web服务器软件用的是Apache2.2,机器只有一台,ip只有一个,但是想测试几个站点,于是尝试了下Apache的虚拟主机配置。之前已经写过一篇博文了——《Apache 根据不同的端口 映射不同的站点》,但是,今天在学习微信公众平台的时候,由于微信公众平台只支持80端口,所以无奈,只能尝试根据不同的域名映射不同的站点。

  

一、修改httpd.conf

  打开Apache的目录,找到httpd.conf文件,分别去掉下面两行文字前面的#号。

 

 #LoadModule vhost_alias_module modules/mod_vhost_alias.s
 #Include conf/extra/httpd-vhosts.conf

二、修改httpd-vhosts.conf

打开该文件,看到以下类似内容。虚拟主机的配置也是参照以下内容配置。下面对该内容进行讲解

<VirtualHost 59.188.244.204>
ServerAdmin webmaster@dummy-host.www.ronghui66.com
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
ServerName ronghui66.com:80 <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs">
#
# 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/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks #
# 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 #
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all </Directory> # ServerAlias www.dummy-host.www.ronghui66.com
ErrorLog "logs/bocai-error.log"
CustomLog "logs/bocai-access.log" common
</VirtualHost> #
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost 59.188.244.204>
ServerAdmin webmaster@dummy-host.www.ronghui66.com
DocumentRoot "D:/wwwroot/weixin"
ServerName 0735wmw.com:80 <Directory "D:/wwwroot/weixin">
#
# 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/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks #
# 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 #
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all </Directory> # ServerAlias www.dummy-host.www.ronghui66.com
ErrorLog "logs/weixin-error.log"
CustomLog "logs/weixin-access.log" common
</VirtualHost>

ServerAdmin 管理员邮箱

DocumentRoot 网站目录 (注意:如果网站目录中的路径有空格,请在路径两端加上双引号)

ServerName 要绑定的域名(必填)

apache 虚拟主机配置(根据不同的域名映射到不同网站)的更多相关文章

  1. Apache虚拟主机配置(多个域名访问多个目录)

    Apache虚拟主机配置(多个域名访问多个目录) 为了方便管理虚拟主机,我决定使用一种方法,那就是修改httpd-vhosts.conf文件. 第一步首先要使扩展文件httpd-vhosts.conf ...

  2. Apache虚拟主机配置(多个域名访问多个目录)(转)

    Apache虚拟主机配置(多个域名访问多个目录) 为了方便管理虚拟主机,我决定使用一种方法,那就是修改httpd-vhosts.conf文件. 第一步首先要使扩展文件httpd-vhosts.conf ...

  3. linux apache虚拟主机配置(基于ip,端口,域名)

    配置环境: linux版本:Centos6.4 httpd版本: [root@centos64Study init.d]# pwd/etc/init.d[root@centos64Study init ...

  4. Apache虚拟主机配置,实现多域名访问本地项目PHP空间,以及配置403Forbidden等错误的解决办法

    第一步: apache主配置文件修改: 用文本编辑器打开apache的conf目录下 httpd.conf 将下面以下代码取消注释 LoadModule rewrite_module  modules ...

  5. Apache虚拟主机配置

    在一个Apache服务器上可以配置多个虚拟主机,实现一个服务器提供多站点服务,其实就是访问同一个服务器上的不同目录.Apache虚拟主机配置有3中方法:基于IP配置.基于域名配置和基于端口配置,这里介 ...

  6. Linux Apache虚拟主机配置方法

    apache 虚拟主机配置 注意: 虚拟主机可以开很多个 虚拟主机配置之后,原来的默认/etc/httpd/httpd.conf中的默认网站就不会生效了 练习: 主机server0 ip:172.25 ...

  7. XAMPP 虚拟主机配置,实现多域名访问本地项目

    XAMPP 虚拟主机配置,实现多域名访问本地项目 1.首先你既然要配置多个虚拟主机,那你肯定需要多个站点的目录文件.你可以在e盘创建 www文件夹,然后在该文件件中新建两个站点目录,假设test.co ...

  8. Linux下Apache虚拟主机配置

    Linux下Apache虚拟主机的三种配置.这样可以实现一台主机架构多个独立域名网站.其中基于域名的最为常见.性价比也最高.下面PHP程序员雷雪松详细的讲解下Linux下Apache虚拟主机配置的具体 ...

  9. apache虚拟主机配置及解析

    Apache虚拟主机配置及解析 1.修改httpd-vhosts.conf 打开apache(Apache24)/conf/extra/httpd-vhosts.conf文件,添加虚拟主机信息,可以这 ...

随机推荐

  1. gitinore修改不生效

    .gitignore只能忽略那些尚未被被track的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的.一个简单的解决方法就是先把本地缓存删除(改变成未track状态),然后 ...

  2. 系统有问题基本出在数据库上,web层无状态

    系统有问题基本出在数据库上,web层无状态.

  3. Python-OpenCV中的filter2D()函数

    使用自定义内核对图像进行卷积.该功能将任意线性滤波器应用于图像.支持就地操作.当光圈部分位于图像外部时,该功能会根据指定的边框模式插入异常像素值. 语法 函数原型: dst=cv.filter2D(s ...

  4. 用dfs求解八皇后问题

    相信大家都已经很熟悉八皇后问题了,就是指:在8X8格的国际象棋上摆放八个皇后,使其不能互相攻击,即任意两个皇后都不能处于同一行.同一列或同一斜线上,问有多少种摆法.主要思路:按行进行深度优先搜索,在该 ...

  5. hd - MFM/IDE 硬盘设备

    描述 DESCRIPTION hd* 开头的设备是以裸模式(raw mode)访问MFM/IDE类型硬盘的块设备. 第一个IDE驱动控制器上的主盘(主设备号3)是 hda ;从盘是 hdb. 第二个I ...

  6. python_79_模块定义导入优化

    ''' 1.定义 模块:用来从逻辑上组织python代码(变量,函数,类,逻辑:实现一个功能),本质就是.py结尾的python文件 (文件名:test.py,对应的模块名:test. import ...

  7. java abstraction and encapsulation

    How is Abstraction different from Encapsulation? Abstraction happens at class level design. It resul ...

  8. spring5之SAXParseException:cvc-elt.1: 找不到元素 “beans” 的声明

    之前SSM项目一直报错,就是找不到错误  气啊 后来在网上找到了答案:燕来spring5之后就不再需要写版本号了

  9. Rop实战之利用VirtualProtect绕过DEP

    CVE-2011-0065 Firefox mChannel UAF漏洞 为了实现任意代码执行,需要在mChannel对象释放后,用可控数据“占坑”填充它,因此,可在onChannelRedirect ...

  10. inner join 和 left join 的区别

    1.left join.right join.inner join的区别 left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录 right join(右联接) 返回包括右表 ...