Apache 사용자 디렉터리를 설정하는 데 도움이 필요합니다.

Apache 사용자 디렉터리를 설정하는 데 도움이 필요합니다.

/srv/http/publicApache가 에서 "일반" 파일을 제공 하고 에서 사용자 파일을 제공하도록 하고 싶습니다 /srv/http/[user]. 따라서 디렉토리는 다음과 같습니다.

/srv/http
  /public
    index.html - Accessible at localhost/index.html
  /austin
    index.html - Accessible at localhost/~austin/index.html

현재 Apache .conf파일 에는 다음과 같은 관련 구성이 있습니다.

User http
Group http
DocumentRoot "/srv/http/public"

<Directory "/srv/http/public">
  Options Indexes FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

UserDir /srv/http
UserDir disabled root

<Directory "/srv/http">
  AllowOverride FileInfo AuthConfig Limit Indexes
  Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  <Limit GET POST OPTIONS>
    Order allow,deny
    Allow from all
  </Limit>
  <LimitExcept GET POST OPTIONS>
    Order deny,allow
    Deny from all
  </LimitExcept>
</Directory>

다음 권한은 다음과 같습니다 /srv/http.

drwxr-xr-x  root    http   /srv/http
drwxr-xr-x  http    http   /srv/http/public
-rwxr-xr-x  http    http   /srv/http/public/index.html
drwxr-xr-x  austin  http   /srv/http/austin
-rwxr-xr-x  austin  http   /srv/http/austin/index.html

이 설정을 사용하면 localhost/index.html잘 표시 localhost/~austin/index.html 되지만403 접근 금지!오류가 발생했습니다. 무엇을 하려고 해도 마찬가지입니다.

편집하다:관련 error_log 항목: [error] [client ::1] client denied by server configuration: /srv/http/austin/index.html

내가 도대체 ​​뭘 잘못하고있는 겁니까?

아, 그리고 별로 중요하지 않다고 생각하지만 저는 Arch Linux와 Apache 2.2.19를 사용하고 있습니다.

답변1

문제는 <Directory>사용자 디렉토리에 대한 지시문이 너무 제한적이라는 것입니다.

디렉토리 에서 동일한 지시어를 재사용하면 /srv/http/public외부 세계에서 모든 사용자 파일을 볼 수 있습니다.

<Directory "/srv/http">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

관련 정보