Nginx配置PATHINFO隐藏thinkphp index.php_nginx

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
, thinkphp
, 配置
, 隐藏
, pathinfo
index.php
thinkphp pathinfo、thinkphp5 pathinfo、thinkphp开启pathinfo、thinkphp3.2 pathinfo、nginx pathinfo,以便于您获取更多的相关知识。

时间: 2024-08-03 22:18:57

Nginx配置PATHINFO隐藏thinkphp index.php_nginx的相关文章

Nginx下配置pathinfo及ThinkPHP的URL Rewrite模式支持_nginx

打开Nginx的配置文件 /usr/local/nginx/conf/nginx.conf 一般是在这个路径,根据你的安装路径可能有所变化.如果你配置了vhost,而且只需要你这一个vhost支持pathinfo的话,可以直接打开你的vhost的配置文件.找到类似如下代码(不同版本的nginx可能稍有不同,但是相差不会很远): 复制代码 代码如下:     location ~ .*.(php|php5)?$         {                 #原有代码         } 修

在nginx中配置pathinfo模式支持thinkphp的URL重写_nginx

最近一个项目中使用了ThinkPHP做为开发框架,URL上我们使用了PATHINFO模式,但是Nginx默认是不支持PATHINFO的,需要进行手动配置才可以,于是我们按照了以下方法进行了Nginx的PATHINFO支持配置:修改nginx.conf,找到server中的 location ~ .php${},修改为location ~ .php {},并在其中增加以下内容: 复制代码 代码如下: set $path_info "";set $real_script_name $fas

Ubuntu下Nginx配置ThinkPHP的Pathinfo和URl Rewrite模式_nginx

概述 在上一篇文章Nginx配置Thinkphp支持URL Rewrite中已经介绍了如何配置Nginx支持ThinkPHP的URL Rewrite,但是上文针对的是Centos平台,这次因为某些特殊的原因,服务器环境必须用ubuntu,本来以为和Cetons中一模一样,但是配置完了发现不能使用,所以就百度了一些文章. 配置方法TP官方解决方案 复制代码 代码如下: location ~ .php         {                 #原有代码                  

nginx中配置pathinfo模式示例_nginx

缘由 很久不使用apache了,渐渐对apache感到陌生,因为朋友有个ZendFramework框架从apache移到nginx下,需要pathinfo模式支持. 网上海搜 于是开始搜索nginx+pathinfo相关文章,一开以为很容易就会配置好.因为搜索后发现有大量文章介绍nginx开启pathinfo模式,感觉不是什么难事.但是经过几个小时下来,还是没有配置好.并且大量文章的内容都极其相似,基本都是转载的. 开始有点急了!因为一天过去了没有配好. 继续摸索 没办法,继续搜索.为了验证方便

服务器-nginx配置thinkphp的rewrite

问题描述 nginx配置thinkphp的rewrite 以前web用apache的架设thinkphp的程序,但是转为nginx的服务器后,一直不能正常网站,就是规则重写的问题: apache的配置:RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSAPTL] RewriteRule ^/?([a-z

nginx 配置了index index.php,但是域名无法访问

问题描述 nginx 配置了index index.php,但是域名无法访问 nginx 配置了index index.php,但是域名无法访问 解决方案 你这个域名申请了吗.绑定到你服务器ip没 解决方案二: ping下,看看域名配置对了没有,跳转到114说明域名没解析对

CI在Nginx服务器上rewrite去掉index.php例子

CI框架在nginx服务器上配置rewrite去掉index.php的方法: vim /usr/local/webserver/nginx/conf/nginx.conf 实例配置代码:  server   {     listen       80;     server_name  www.111cn.net;     index index.html index.htm index.php;     root  /data0/htdocs/lamp100;       #nginx去掉in

nginx配置yii2.0重写的例子

apache和nginx比起来,我更倾向nginx,占用资源少,且性能高,不管是开发还是生产环境都很好用.那么,如何配置nginx让其支持yii2.0的访问呢? 配置范例如下: server {     listen       80;     server_name  reson.com;     location / {         root   D:/wwwroot/reson/web;         index  index.html index.php;   if (!-e $r

Nginx配置srcache_nginx模块搭配Redis建立缓存系统_nginx

1. nginx模块 --add-module=../modules/ngx_devel_kit-0.2.18 --add-module=../modules/set-misc-nginx-module-0.22rc8 --add-module=../modules/srcache-nginx-module-0.22 --add-module=../modules/redis-nginx-module-0.3.6 --add-module=../modules/redis2-nginx-modu