【寻求帮助】请给出nginx环境的静态.htaccess规则
qiurigao opened this issue · 3 comments
qiurigao commented
.htaccess转换成nginx规则
yuantuo666 commented
本项目使用 ThinkPHP 框架,请查阅相关文档进行配置:https://doc.thinkphp.cn/v8_0/url_access.html
Deleted user commented
添加这段代码即可
location / {
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
下面是我用的配置,可以参考一下,别直接拿来用,可能会报错。
server {
listen [::]:8003 ipv6only=off;
root /data/data/com.termux/files/home/nginx/vhost/baiduwp/public;
index index.php index.html;
location / {
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
location ~ \.php?.*$ {
fastcgi_pass unix://data/data/com.termux/files/usr/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
yuantuo666 commented
如有问题请重新打开此议题。