server {
listen 80;
server_name pwta;
root html;
location /test/{
alias html/test/;
autoindex on;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Run Code Online (Sandbox Code Playgroud)
这种配置有效.但是,如果location /test/被替换,例如location /testpath/它不起作用(没有指定输入文件).我假设根据别名指令的解释,"位置"部分被删除,从而/testpath/info.php导致html/test/info.php.
谢谢你的任何建议.