apache虚拟主机配置一例

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

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>

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

相关文章

英国cn2虚拟主机租用有哪些好处

英国cn2虚拟主机租用的好处有:1、价格实惠与独立服务器相比,虚拟主机的租用价格更为实惠,适合小型网站和个人博客等。2、管理简单虚拟主机的管理相对简单,无需担心硬件维护和升级等问题。3、高可靠性虚拟主...

美国cn2虚拟主机租用怎么管理

管理美国cn2虚拟主机需要以下步骤:1、登录虚拟主机控制面板或使用SSH连接到虚拟主机。2、管理文件和目录,包括创建、删除、复制、移动和重命名文件和目录。3、管理数据库,包括创建、删除、备份和恢复数据...

美国独立ip虚拟主机怎么选择

美国独立ip虚拟主机选择的方法:1、看美国独立ip虚拟主机的访问速度是否在200ms以下;2、测试美国独立ip虚拟主机的稳定性,并对不同时段的访问速度做好记录;3、选择具有高防御性能的美国独立ip虚拟...

选择免备案国外虚拟主机要注意哪些问题

选择免备案国外虚拟主机要注意的问题有:1、注意国外虚拟主机的IIS连接数,IIS连接数设置低,会影响用户访问网站;2、注意国外虚拟主机的流量限制,考虑是否满足自身网站的需求;3、注意国外虚拟主机的负载...

怎么判断免备案香港虚拟主机好与不好

判断免备案香港虚拟主机好与不好的方法:1、看稳定性,香港虚拟主机稳定性不好会影响网站的排名;2、看访问速度,香港虚拟主机访问速度的快慢会影响网站用户体验;3、看服务商,好的服务商所提供的服务器产品质量...

国外虚拟主机租用能放多少个网站

国外虚拟主机租用能放的网站数量要看:1、国外虚拟主机的配置,配置越高,能放的网站数量越多;2、网站日常流量,如高流量网站所消耗的带宽量多,可建站的数量少;3、业务拓展情况,如果网站业务快速增长,会导致...