apache虚拟主机配置一例

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

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、安装复制代码代码如下:./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl ...

apache虚拟主机配置: 二级目录访问跳转到其他根文件夹

访问 abc/course/ ,实际访问的是:d:/www/moodle/index.PHP?12345678910111213<VirtualHost *:80>   ...

香港服务器tomcat、nginx以及apache环境之间的区别

近些年、国内用户使用香港服务器的越来越多,不同的用户选择使用香港服务器的环境也是不同的,如tcat、nginx以及apache等环境。那么,香港服务器tcat、nginx以及apache环境的区别有哪...

winxp apache用php建本地虚拟主机的方法

1 在C:\WINDOWS\system32\drivers\etc\hosts添加如下代码:127.0.0.1 localhost127.0.0.1 x.test x.test1 x.test2注:...

apache 二级域名解析 (window与linux)

winxp os:c:/windows/system32/drivers/etc/hostsadd a line like :127.0.0.1 hangzhou.localhost127.0.0.1...

xampp中apache在windows7下无法启动的解决方法

环境windows 7 32位下载zip版本的xampp,无法启动apache ,现象是短暂显示了running标志之后就停止了,日志显示WARNING:terminating worker thre...