欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

apache虚拟主机配置一例

程序员文章站 2023-11-16 09:02:40
复制代码 代码如下:fivetrees extra # cat httpd-vhosts.conf_bak## virtual hosts## if you want to...

复制代码 代码如下:

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:http://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.com
</virtualhost>
<virtualhost *:80>
        documentroot /opt/2
        servername 2.com
</virtualhost>

#<virtualhost *:443>
#        documentroot /home/hello
#        servername hello.baidu.com
#</virtualhost>