当前位置: 移动技术网 > 网络运营>服务器>Linux > apache虚拟主机配置一例

apache虚拟主机配置一例

2019年05月03日  | 移动技术网网络运营  | 我要评论
复制代码 代码如下: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>

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网