httpd.conf文件内容如下(这里不能写太多内容,前面有#的行我都给删掉了)Define SRVROOT "D:/Apache24"
ServerRoot "${SRVROOT}"Listen 80LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule php5_module "D:/php5.6.1/php5apache2_4.dll"
PHPIniDir "D:/php5.6.1"
AddType application/x-httpd-php .php .html .htm
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
ServerAdmin [email protected]
ServerName localhost:80
<Directory />
    AllowOverride none
    Require all denied
</Directory>
#DocumentRoot "${SRVROOT}/htdocs"-----这里要是把#去掉可以成功,但是根目录就不是我想要的了
DocumentRoot "D:/www"
<Directory "D:/www">-----这里要是填成${SRVROOT}/htdocs可以成功,但是根目录就不是我想要的了
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<IfModule dir_module>
    DirectoryIndex index.php index.html 
</IfModule><Files ".ht*">
    Require all denied
</Files>ErrorLog "logs/error.log"LogLevel warn<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "logs/access.log" common
</IfModule><IfModule alias_module>
    ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"
</IfModule><IfModule cgid_module>
</IfModule><Directory "${SRVROOT}/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory><IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .html
</IfModule><IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule><IfModule ssl_module>
Include conf/extra/httpd-sni.conf
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
不改documentRoot可以正常运行,我想让根目录为d:/www

解决方案 »

  1.   

    那个目录 apache用户有权限读吗?
      

  2.   

    稀烂的中国网友,也碰到了这个问题,
    httpd.conf中的DocumentRoot文件权限默认就有Require all granted,这个没有问题,一大堆垃圾回复。在国外的网站上搜了好长时间终于找到问题了。
    还要修改Apache24\conf\extra\httpd-vhosts.conf<VirtualHost _default_:80>
    #DocumentRoot "${SRVROOT}/htdocs"
    DocumentRoot "d:/www"
    #ServerName www.example.com:80
    </VirtualHost>希望对后来者有帮助
      

  3.   

    上法可以成功,但安全问题仍然存在!
    假设我是虚拟主机用户,用php遍历一下服务器web目录,就什么都看见了
      

  4.   

    <Directory />
        AllowOverride none
        Require all denied
    </Directory>要允许目录的权限 要给 给个777 好了
      

  5.   

    需要root权限。
      

  6.   

    Quote: 引用 2 楼 yyywill 的回复:

    稀烂的中国网友,也碰到了这个问题,You don't have permission to access / on this server.
    httpd.conf中的DocumentRoot文件权限默认就有Require all granted,这个没有问题,一大堆垃圾回复。在国外的网站上搜了好长时间终于找到问题了。
    还要修改Apache24\conf\extra\httpd-vhosts.conf<VirtualHost _default_:80>
    #DocumentRoot "${SRVROOT}/htdocs"
    DocumentRoot "d:/www"
    #ServerName www.example.com:80
    </VirtualHost>太经典了,我纠结了一下午了快,感谢!
      

  7.   

    回复于: 2015-04-22 13:42:18  稀烂的中国网友,也碰到了这个问题,
    httpd.conf中的DocumentRoot文件权限默认就有Require all granted,这个没有问题,一大堆垃圾回复。 在国外的网站上搜了好长时间终于找到问题了。
     还要修改Apache24\conf\extra\httpd-vhosts.conf <VirtualHost _default_:80>
     #DocumentRoot "${SRVROOT}/htdocs"
     DocumentRoot "d:/www"
     #ServerName www.example.com:80
     </VirtualHost>希望对后来者有帮助 特意注册个号上来回复 只为感谢 郁闷我好多天的问题终于解决
      

  8.   


    依然不行,哎,真是蛋碎  这傻逼APache2.4.23
      

  9.   


    将_default_改成127.0.0.1即可,其它什么也不用改
      

  10.   

    用虚拟主机设置代替默认的DocumentRoot设置
      

  11.   

    #配置自己的虚拟主机
    <VirtualHost  127.0.0.1:80>
        #网站目录
        DocumentRoot "D:\myServer\Apache24\ss" 
        #域名
        ServerName www.iepvps.com
        #这里配置欢迎首页面
        DirectoryIndex qq.html 5.html  index.html index.htm index.php
        <Directory />
        Options FollowSymLinks
        #不允许别人修改我们的页面
        AllowOverride None
        #设置访问权限
        order allow,deny
        Allow from all
        Require all granted    </Directory>   
    </VirtualHost>
    通过http://localhost/即可访问ss目录下的页面