apache虚拟主机配置一例

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

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虚拟主机的实例小结

1、基于ip地址的虚拟主机 复制代码 代码如下:Listen 80<VirtualHost 172.20.30.40>    DocumentRoo...

WampServer下安装多个版本的PHP、mysql、apache

今天,我在调试一套php程序的时候,该程序中使用的某些函数在低版本中无法使用,所以只能在搞个高版本的php。作为web开发人员,在机器上安装不同版本的php,apache和mysql有时是很有必要的。...

apache 二级域名解析实现方法

复制代码 代码如下:RewriteEngine onRewriteMap lowercase int:tolowerRewriteMap vhost txt:/usr/local/etc/apache...

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

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

WINDOWS下php5.2.4+mysql6.0+apache2.2.4+ZendOptimizer-3.3.0配置

第一: 装http服务器apacheapache安装完成,如果出现apache端口被占用的情况,请关闭你的迅雷,或者某些杀毒软件!第二步:安装PHP:1)、将php-5.2.4-Win32.zip压缩...

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

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