首页 > 网站 > Apache > 正文

apache虚拟主机配置一例

2024-08-27 18:26:48
字体:
来源:转载
供稿:网友

复制代码 代码如下:

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>

您可能感兴趣的文章:

apache虚拟主机三种配置方式小结在Apache服务器上添加虚拟主机功能的方法给Apache虚拟主机增加端口的方法apache服务器一个ip(如:127.0.0.1)和多个域名(虚拟主机)的绑定apache虚拟主机的配置指南apache中使用mod_gnutls模块实现多个SSL站点配置(多个HTTPS协议的虚拟主机)apache配置虚拟主机的方法详解13个实用的Apache Rewrite重写规则Apache伪静态Rewrite详解Apache Rewrite实现URL的301跳转和域名跳转Apache Rewrite url重定向功能的简单配置用ISAPI_Rewrite让IIS也支持如Apache下.htaccess的URL重写Apache中Virtual Host虚拟主机配置及rewrite参数说明
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表