相対 URL で Nginx を使用して roundcube / phpldapadmin / ... をセットアップしようとしています。
example.com/roundcube
example.com/phpldapadmin
ソースは次のフォルダーにあります。
/var/www/roundcube
/usr/share/phpldapadmin
Apache 2.4 ではすべて正常に動作していましたが、Nginx は初めてです。私は次location
のものを持っていますroundcube
:
location /roundcube/ {
root /var/www;
index index.php;
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
これは正常に機能しますが、次の場合phpldapadmin
は機能しません。
location /phpldapadmin/ {
alias /usr/share/phpldapadmin/htdocs;
index index.php index.html index.htm;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
403 forbidden
次のログを含む を取得します。
2016/02/07 21:43:33 [エラー] 23047#0: *1 "/usr/share/phpldapadmin/htdocs" のディレクトリインデックスは禁止されています, クライアント: xxx.xxx.xxx.xxx, サーバー: , リクエスト: "GET /phpldapadmin/ HTTP/1.1"、ホスト: " "
許可を確認しました:
$ namei -om /usr/share/phpldapadmin/htdocs
f: /usr/share/phpldapadmin/htdocs
drwxr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root share
drwxr-xr-x root root phpldapadmin
drwxr-xr-x root www-data htdocs
$ ls -l /usr/share/phpldapadmin/htdocs/index.php
-rw-r--r-- 1 root root 20036 Oct 28 17:32 /usr/share/phpldapadmin/htdocs/index.php
所有者をに変更しようとしました:www-data
が、うまくいきませんでした。roundcube に対して次のことを試したところ、うまくいきませんでした:
location /roundcube/ {
alias /var/www/roundcube;
...
}
これはおそらく末尾/
の 、または同様の問題であると考えていますが、nginxを初めて使用するため、見つけることができません...
基本的に、私は次の逆の問題を抱えています: https://stackoverflow.com/questions/31820362/nginx-403-directory-is-forbidden-when-using-root-location