2016-12-30 1 views
3

이 서버에/액세스 권한이 없습니다 :아파치 당신은 내가 오류 받고 있어요 <code>clg.localhost/</code>에서

You don't have permission to access/on this server.

을하지만, this 다음, 나는 액세스 할 수 있도록 내 아파치 httpd.confsites.conf을 설정 한 AllowOverride allRequire all granted입니다. 내가 뭘 놓치고 있니?

버전 :

$ /usr/sbin/httpd -v 
Server version: Apache/2.4.23 (Unix) 
Server built: Aug 8 2016 18:10:45 

아파치의 httpd.conf :

DocumentRoot "/Users/danniu/Sites" 
<Directory "/Users/danniu/Sites"> 
    # 
    # Possible values for the Options directive are "None", "All", 
    # or any combination of: 
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 
    # 
    # Note that "MultiViews" must be named *explicitly* --- "Options All" 
    # doesn't give it to you. 
    # 
    # The Options directive is both complicated and important. Please see 
    # http://httpd.apache.org/docs/2.4/mod/core.html#options 
    # for more information. 
    # 
    Options FollowSymLinks Multiviews 
    MultiviewsMatch Any 

    # 
    # AllowOverride controls what directives may be placed in .htaccess files. 
    # It can be "All", "None", or any combination of the keywords: 
    # AllowOverride FileInfo AuthConfig Limit 
    # 
    AllowOverride all 

    # 
    # Controls who can get stuff from this server. 
    # 
    Require all granted 
</Directory> 

... 

# 
# Deny access to the entirety of your server's filesystem. You must 
# explicitly permit access to web content directories in other 
# <Directory> blocks below. 
# 
<Directory /> 
    AllowOverride all 
    Require all granted  
</Directory> 

아파치 sites.conf :

나는 아마 httpd.conf이 제대로 포착되지 않고 있다고 생각
# Workaround for missing Authorization header under CGI/FastCGI Apache: 
<IfModule setenvif_module> 
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0 
</IfModule> 

# Serve ~/Sites at http://localhost 
ServerName localhost 

<VirtualHost *:80> 
    ServerName clg.localhost 
    DocumentRoot /Users/danniu/Sites/CLG/CLG-dev 
</VirtualHost> 

, 그래서 동일한 문제로 가상 호스트에서 직접 루트를 지정했습니다. 당신이 인덱스 파일은 index.html과 같은 DirectoryIndex에와 지적하지 않아도, 당신은 인덱스를 사용할 수없는, 그래서 만약

<VirtualHost *:80> 
    ServerName clg.localhost 
    DocumentRoot /Users/danniu/Sites/CLG/CLG-dev 
    # Set access permission 
    <Directory "/Users/danniu/Sites/CLG/CLG-dev"> 
    Require all granted 
    </Directory> 
</VirtualHost> 
+0

'/ Users/danniu/Sites/CLG/CLG-dev'의 루트에'index.html','default.htm'과 같은 기본 문서 유형과 일치하는 파일이 있는지 확인하고, 아파치 설정에서 해당 설정을 제거하십시오. –

+0

@KraangPrime 그것은'index.php'입니다. 그래도 여전히'index'를 선택해야합니다. 그렇습니까? 그렇지 않다면 어떻게 PHP 파일로 지정할 수 있습니까? 그리고 아파치 설정의 어떤 설정에 대해 이야기하고 있습니까? – Growler

+0

아파치 설정에서의 설정은'DirectoryIndex'입니다. 예 :'DirectoryIndex index.php default.php index.htm default.htm index.html default.html index.phps'. php 파일을 실행하는 경우 - 손쉽게 일반 HTML 파일을 표시 할 수 있는지 확인하십시오. PHP가 설치되어 있고 모듈이 제대로 링크되어 있다고 가정합니다. –

답변

2

/당신이하지 않는 한, 아파치 수, 디렉토리입니다 문서 루트의 내용을 표시하지 마십시오.

참고 옵션은 인덱스를 추가 좋아하는 당신은, Options FollowSymLinks Multiviews

솔루션이 (이 이전에 mod_autoindex가이로드에 따라 다름) "디렉토리 목록"에 대해 다음과

Options FollowSymLinks Multiviews Indexes 

당신이 기본 파일을 원하는 경우 예를 들어, index.html과 같이로드 된 index.html과 같은 DirectoryIndex는 기본적으로 index.html을 찾습니다. 추가하거나 다른 곳에서 해당 동작을 대체하는 무언가가있는 경우 :

DirectoryIndex index.html 
관련 문제