要让 Nginx 支持访问 html/bo
目录下的 index.php
,你可以添加一个新的 location
块。以下是修改后的配置:
location /bo {
root html;
index index.php;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
在这个配置中,我们添加了一个名为 /bo
的新的 location
块,指定了根目录为 html
,这个块会处理所有以 /bo
开头的请求。然后,我们指定了 index
为 index.php
,这意味着当访问 /bo
时,Nginx 将会尝试在 /bo
目录下查找 index.php
文件。
同时,原有的 location
块保持不变,继续处理所有以 .php
结尾的请求。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容