• 配置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');

  • 相关阅读:
    squid反向代理
    LVM逻辑卷管理
    磁盘分区
    磁盘阵列
    apache基本配置
    LNMP简要配置
    高性能Web服务器Nginx
    samba文件共享服务配置(multiuser机制)二 (共两节)
    samba文件共享服务配置一(共2节)
    linux 批量修改文件名 文件名只保留部分,去掉部分
  • 原文地址:https://www.cnblogs.com/suxiaolong/p/5781371.html
Copyright © 2020-2023  润新知