+ -
当前位置:首页 → 问答吧 → 新配置出的apache2.2虚拟主机特来共享一下

新配置出的apache2.2虚拟主机特来共享一下

时间:2008-04-03

来源:互联网

写的比较简单,目前只搞了这一种配置方法,原谅……

1,httpd.conf

(1), 将“#LoadModule vhost_alias_module modules/mod_vhost_alias.so”前的“#”号去掉
(2),将“#Include conf/extra/httpd-vhosts.conf” 前的“#”号去掉

2,conf\extra\httpd-vhosts.conf


<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot D:/www/hosts/localhost
    ServerName localhost
    ErrorLog D:/www/logs/localhost-error_log
    CustomLog D:/www/logs/localhost-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot D:/www/hosts/demo1
    ServerName demo1
    ErrorLog D:/www/logs/demo1-error_log
    CustomLog D:/www/logs/demo1-access_log common
</VirtualHost>

3,C:\WINDOWS\system32\drivers\etc\hosts


127.0.0.1        localhost
127.0.0.1        demo1


4,目录

D:/www/hosts
D:/www/logs
D:/www/hosts/localhost //这里新建一个index.php
D:/www/hosts/demo1 // 这里新建一个index.php

分别在IE中输入http://localhost 和 http://demo1 来浏览两个虚拟主机中的内容

若出现403错误,打开 httpd.conf

修改
<Directory />
    Options FollowSymLinks ExecCGI Indexes
    AllowOverride None
    Order deny,allow
    deny from all
    Satisfy all
</Directory>



<Directory />
    Options FollowSymLinks ExecCGI Indexes
    AllowOverride None
    Order allow,deny
    allow from all
    Satisfy all
</Directory>


再试就OK了……

[ 本帖最后由 dx_andy 于 2008-4-3 14:11 编辑 ]

作者: dx_andy   发布时间: 2008-04-03

<Directory />
    Options FollowSymLinks ExecCGI Indexes
    AllowOverride None
    Order allow,deny
    allow from all
    Satisfy all
</Directory>
这样安全性太低了!

作者: thaiki   发布时间: 2008-04-03

<Directory />
    Options FollowSymLinks ExecCGI Indexes
    AllowOverride None
    Order allow,deny
    deny from all
    Satisfy all
</Directory>
下面加上
<Directory /你的目录>
    Options FollowSymLinks ExecCGI Indexes
    AllowOverride None
    Order allow,deny
    allow from all
    Satisfy all
</Directory>
就可以了,两者不冲突!

作者: thaiki   发布时间: 2008-04-03

谢谢,我是本地测试用,也没考虑那么多,多谢指点

作者: dx_andy   发布时间: 2008-04-03

热门下载

更多