Nginx的禁用URL重写我的网址如下nginx的配置改写特定的路径/ URL
location/{ ##merge
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location /devtools/phpmyadmin/ { ##merge
root /var/www/domain.tld/web;
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/lib/php5-fpm/web2.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
在
/var/www/domain.tld/web/
目录
有/api/
目录,我想禁用URL重写此。因此,如果我想通过url访问index.php
:http://domain.tld/api/index.php/function/method
如何修改nginx配置文件?
编辑:
我尝试以下方法改写,但不工作:
location = /api {
rewrite^/api/index.php;
}
在第一个“位置”块上方是否存在“root”指令?你在'server'块级有一个'location〜\ .php $'块吗? –
@RichardSmith在第一个位置块之上没有root指令,另一个问题是no - 我从ispconfig编辑nginx配置 – wpdaniel