example.com/phpmyadmin を自分のサイトから別のディレクトリにルーティングして、すべてのサイトで 1 つのユニバーサル phpmyadmin インストールを使用できるようにしようとしています。私はこれを試しました:
server {
listen 80;
server_name example.com;
location / {
root /home/web/example.com/public_html;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /home/web/example.com/public_html;
if ($request_uri ~* /phpmyadmin) {
root /home/web/phpmyadmin;
}
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
これはまったく機能していないようです。
そして、私もこれを試しました:
server {
listen 80;
server_name example.com;
location / {
root /home/web/example.com/public_html;
index index.html index.htm index.php;
}
location /phpmyadmin {
root /home/web/phpmyadmin;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /home/web/example.com/public_html;
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
このファイルでエラーログを確認すると、次のようになります。
2013/06/28 01:10:47 [error] 7068#0: *1 "/home/web/phpmyadmin/phpmyadmin/index.html" is not found (2: No such file or directory)
そのため、場所ブロックでルートを /home/web に変更し、余分な phpmyadmin が削除されると考えましたが、代わりに、エラーログに phpmyadmin について何も表示されません。正しい構成と、これが機能しない理由を理解できないようです。何か案は?