apache虚拟主机配置一例

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

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>

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

相关文章

WampServer下安装多个版本的PHP、mysql、apache

今天,我在调试一套php程序的时候,该程序中使用的某些函数在低版本中无法使用,所以只能在搞个高版本的php。作为web开发人员,在机器上安装不同版本的php,apache和mysql有时是很有必要的。...

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...

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

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

apache开启.htaccess及.htaccess的使用方法

今天本地调试PHP程序,用到了.htaccess,而默认配置里面开启.htaccess,在网上找到了开启.htaccess的可行方法,供朋友们借鉴。(开启的我他的方法不行,查找了一下AllowOver...

解决宝塔面板nginx/apache防火墙后无法启动

宝塔面板是最好用的服务器管理面板,不过有些插件是需要收费的,免费版的Nginx防火墙的功能比收费版Nginx防火墙要差一些,能有钱是更好的,不管是开心版还是正版,我只要安装了nginx防火墙以后,ng...