问题原文
原帖链接 · Bruce · CC BY-SA 4.0
I have a PHP site that's running fine. Now I need to add URL /adminer/ that is mapped to a directory outside of the root and there I have an index.php file that needs to be executed. I have following config (Debian 9.7):
server {
listen 80;
root /home/usr/www/xxx.xxx/web/app/www;
index index.php;
server_name xxx.xxx;
location /adminer {
root /home/usr/www/xxx.xxx/web/adminer;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/xxx.xxx.php7.0-fpm.socket;
}
}
When I open http://xxx.xxx/adminer/ I always get 404. I am trying for more than a hour different configs but can't find a working way. Thanks
已采纳解答
原帖链接 · Bruce · CC BY-SA 4.0
Based on Richar Smith's comment, this is a working config:
server {
listen 80;
root /home/usr/www/xxx.xxx/web/app/www;
index index.php;
server_name xxx.xxx;
location /adminer {
root /home/usr/www/xxx.xxx/web;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/xxx.xxx.php7.0-fpm.socket;
}
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/xxx.xxx.php7.0-fpm.socket;
}
}
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
