小编All*_*lfo的帖子

nginx别名+位置指令

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.

谢谢你的任何建议.

alias location nginx

10
推荐指数
2
解决办法
4万
查看次数

标签 统计

alias ×1

location ×1

nginx ×1