zoukankan      html  css  js  c++  java
  • 配置nginx支持TP框架

    TP框架配置中默认URL_MODEL=1,而Nginx默认是不支持PATHINFO的。如果我们只想跑起来tp框架,很简单,只需到更改TP配置,设置URL_MODEL=3(兼容模式)。但是如果要让Nginx支持ThinkPHP PATHINFO需要做如下配置:
    
    1、设置ThinkPHP URL模式URL_MODEL=12、修改nginx配置文件(红色部分更改称相应的内容)
    server
    {
    listen 80;
    server_name www.myblog.com;
    index index.php;
    root /Users/just/git/myblog;
    
    location / {
    if (!-e $request_filename) {
    rewrite  ^/(.*)$  /index.php/$1  last;
    break;
    }
    }
    
    location ~ .php {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi_params;
    set $real_script_name $fastcgi_script_name;
    if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
    set $real_script_name $1;
    set $path_info $2;
    }
    fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
    fastcgi_param SCRIPT_NAME $real_script_name;
    fastcgi_param PATH_INFO $path_info;
    }
    }
    
    3、保存nginx配置并重启

    源自: http://yplove.blog.51cto.com/8793750/1749106

    如果默认模块可以访问,其他模块不能访问,尝试将入口文件处含有 BIND_MODULE 的注释掉
    define('BIND_MODULE','Stage');

  • 相关阅读:
    自控力和专注力是执行力的保证
    今宵又除夕
    买了小米盒子三代
    电容相位滞后?电感超前
    lcr电桥浅谈
    ad 线束和网络
    浅谈 R_S触发器
    NTSC PAL 介绍
    verilog 之流水灯
    io 口方向调整 stm32
  • 原文地址:https://www.cnblogs.com/suxiaolong/p/5781371.html
Copyright © 2011-2022 走看看