您的位置:首页 > 运维架构 > Apache

apache2.4 建虚拟目录

2015-09-15 14:28 531 查看
参考:主要修改地方

2、第二个修改地方

打开httpd.conf文件
去掉LoadModule vhost_alias_module modules/mod_vhost_alias.so
这句前面的#号
和
Include conf/extra/httpd-vhosts.conf这句前面的#号

Include conf/extra/httpd-vhosts.conf这句在httpd.conf文件底部

然后打开Apache2.2\conf\extra下的httpd-vhosts.conf文件,加入如下代码

#配置自己的虚拟主机
<VirtualHost *:80>
    #网站目录,如果在www目录下的php目录,下面    #就填写F:/www/php
    DocumentRoot "D:/WALP/www" 
    #域名
    ServerName www.plqjnet.com
    #这里配置欢迎首页面
    DirectoryIndex index.html index.htm index.php
    <Directory />
    Options FollowSymLinks
    #不允许别人修改我们的页面
    AllowOverride None
    #设置访问权限
    order allow,deny
    Allow from all
    </Directory>   
</VirtualHost>

把ServerName改成你自己的,最后重启Apache。

这样改了还是不能访问,需修改httpd.conf

<span style="font-size: x-small;">#

# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

# directory (and its subdirectories).

#

# First, we configure the "default" to be a very restrictive set of

# features.

#

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

</Directory></span> 成

<span style="font-size: x-small;"># 允许指向外部的目录进行访问

<Directory />

Options Indexes FollowSymLinks

AllowOverride None

</Directory></span>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: