apache虚拟主机配置一例

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

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>

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

相关文章

云服务器(云主机)与虚拟主机有什么区别

云服务器(云主机)与虚拟主机有什么区别?在以前,网站制作者在网站设计完成后,一般都是通过购买空间,这里的空间,也就是虚拟主机来存放网站程序,大致流程就是在线开通虚拟主机,通过本地电脑FTP软件上传程序...

免备案虚拟主机购买怎么评估性能

免备案虚拟主机购买评估性能的方法:1、看虚拟主机的稳定性,如是否能保证服务器7*24小时不间断运行;2、看虚拟主机的扩展性,好的虚拟主机可以支持在线升级扩容,保证网络、带宽等能承担足够的负荷;3、看虚...

台湾虚拟主机租用有哪些优势

台湾虚拟主机租用的优势有:1、不需要备案,能省去繁琐的备案流程和时间,直接解析绑定使用;2、采用国际带宽节点,能确保网络运行安全稳定,不存在南北互访问题;3、访问速度快,对外贸友好度高,很适合做外贸网...

国外虚拟主机商有哪些

国外虚拟主机商有很多,以下是一些常见的虚拟主机商:1、Bluehost是美国一家知名的虚拟主机服务商,提供多种虚拟主机方案,包括共享主机、VPS和独立服务器等。2、HostGator是美国一家知名的虚...

企业网站采用虚拟主机有什么好处

企业网站采用虚拟主机的好处有:1.降低成本,费用低;2.节省时间;3.提高效率,缩短建站周期;4.操作便利,通过控制面板操作;具体分析如下:1.降低成本虚拟主机价格不会太高,对于很多发展中企业来说,降...

免费海外虚拟主机好用吗

免费海外虚拟主机好用:1、海外虚拟主机运行稳定,可靠性好,能保证网站的正常运行;2、海外虚拟主机安全性高,支持硬件防火墙层、cdn层、主机层联动CC防护,能有效拦截SQL注入和防御ddos攻击;3、海...