本篇内容介绍了“Nginx怎么配置PATHINFO隐藏thinkphp index.php”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
nginx配置pathinfo隐藏index.php
nginx配置文件里放入这段代码
server {
listen 80;
default_type text/plain;
root /var/www/html;
index index.php index.htm index.html;
#隐藏index.php
location / {
if (!-e $request_filename) {
#一级目录
# rewrite ^/(.*)$ /index.php/$1 last;
#二级目录
rewrite ^/myapp/(.*)$ /myapp/index.php/$1 last;
}
}
#pathinfo设置
location ~ \.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param path_info $fastcgi_path_info;
fastcgi_param script_filename $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
“Nginx怎么配置PATHINFO隐藏thinkphp index.php”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注天达云网站,小编将为大家输出更多高质量的实用文章!