Nginx配置支持rewrite
程序员文章站
2022-06-16 23:21:04
...
Nginx配置支持rewrite
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) #支持thinkphp
{
rewrite ^/([^(public_inf)].*)$ /index.php?s=$1 break; # 隐藏index.php
break;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
if (!-e $request_filename) #支持thinkphp
{
rewrite ^/([^(public_inf)].*)$ /index.php?s=$1 break; # 隐藏index.php
break;
}
AD:真正免费,域名+虚机+企业邮箱=0元
推荐阅读
-
nginx 源码学习笔记(十三)——文件读写和配置文件读取
-
在 FreeBSD 10.0 上安装和配置 Nginx+PHP+APC+MySQL
-
ubuntu下配置nginx+php+mysql详解_PHP
-
nginx+php-fpm组合解决PATHINFO最佳配置
-
配置Nginx多核CPU,worker_cpu_affinity使用方法和范例 affinity ds2 2 affinity 28 affinity
-
Nginx负载均衡以及动静分离的原理与配置
-
Windows下用Nginx配置https服务器及反向代理的问题
-
win10安装配置nginx的过程
-
nginx中path模式配置示例
-
Nginx下配置301重定向的正确方法例子