/srv/http/public
Apacheに「通常の」ファイルを から、ユーザーファイルを から提供させたいので/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>