apache虚拟主机配置一例

admin3年前主机评测111
复制代码 代码如下:

fivetrees extra # cat httpd-vhosts.conf_bak
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#NameVirtualHost *:443
#
# 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 192.168.1.66>
#        RewriteEngine On
#        RewriteMap      lowercase       int:tolower
#        RewriteMap      vhost   txt:/usr/local/apache/conf/host.txt
#        RewriteCond     %{HTTP_HOST}    !^$
#        RewriteCond     ${lowercase:%{HTTP_HOST}|NONE}  ^(.+)$
#        RewriteRule     ^/(.*...)$ ${vhost:%1...}/$1
#</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/all_dir
        ServerName *
</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/1
        ServerName 1
</VirtualHost>
<VirtualHost *:80>
        DocumentRoot /opt/2
        ServerName 2
</VirtualHost>

 

#<VirtualHost *:443>
#        DocumentRoot /home/hello
#        ServerName hello.baidu
#</VirtualHost>

免责声明:本文内容来自用户上传并发布,站点仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请核实广告和内容真实性,谨慎使用。

相关文章

深入apache host的配置详解

<VirtualHost *:80>    ServerAdmin webmaster@dummy-host.127.0.0.1  &nb...

apache下支持asp.net的实现方法

1.安装framework(具体版本可以自己选,建议装netframework3.5sp1)2.安装mod_aspdotnet.so,这个支持apache2.2的不好找,附上mod_aspdotnet...

nginx/apache/php隐藏http头部版本信息的实现方法

1、nginx隐藏头部版本信息方法     编辑nginx.conf配置文件,在http{}内增加如下一行 复制代码 代码如下:http { ...

apache启动失败怎么办 快速解决Win10系统apache启动失败的方法教程

很多朋友在建网站的时候都会事先在本地搭建好服务器,然后再传到网站上。但是在本地计算机启动Apache的时候,经常会遇到Apache启动失败的提示,Apache启动失败如何解决呢?今天小编来教您快速解决...

分享apache http服务器设置虚拟主机的方法

在apache http服务器上,设置虚拟主机(virtual host)的方法如下打开apache 安装目录下面的conf/httpd.conf,加入下面两段复制代码 代码如下:<Virtua...

Win2003+apache+PHP+SqlServer2008 配置生产环境

 安装前的准备:?12345678910111.Apache2.2.2 2.PHP5.2.17 3.SqlServer2008 4.sqlncli.msi(Sq...