zoukankan      html  css  js  c++  java
  • thinkcmf3 和thinkcmf5 在 Nginx 配置的区别

    配置教程:https://www.thinkcmf.com/topic/351.html
    Thinkcmf3:
    server {
            listen       80;
            server_name  lh.scapp.nd.com lh.scapp.nd.com;
            root   "D:/phpStudy/WWW/sc_app";
            location / {
                index  index.html index.htm index.php;
                #autoindex  on;
            }
            location ~ .php(.*)$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO  $fastcgi_path_info;
                fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
                include        fastcgi_params;
            }
    }


    根目录放置:Nginx.conf
    location / { // …..省略部分代码
       if (!-e $request_filename) {
       rewrite  ^(.*)$  /index.php?s=$1  last;
       break;
        }
    }

    thinkcmf5  :

    server{
        listen 80;
        server_name  lh.rsh.nd.com;
        root "D:/phpStudy/WWW/rsh/public"; #该项要修改为你准备存放相关网页的路径
        location / {
            index  index.php index.html index.htm;
             #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
             if (!-e $request_filename)
             {
                #地址作为将参数rewrite到index.php上。
                rewrite ^/(.*)$ /index.php/$1;
                #若是子目录则使用下面这句,将subdir改成目录名称即可。
                #rewrite ^/subdir/(.*)$ /subdir/index.php/$1;
             }
        }
        #proxy the php scripts to php-fpm
        location ~ .php {
                include fastcgi_params;
                ##pathinfo支持start
                #定义变量 $path_info ,用于存放pathinfo信息
                set $path_info "";
                #定义变量 $real_script_name,用于存放真实地址
                set $real_script_name $fastcgi_script_name;
                #如果地址与引号内的正则表达式匹配
                if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
                        #将文件地址赋值给变量 $real_script_name
                        set $real_script_name $1;
                        #将文件地址后的参数赋值给变量 $path_info
                        set $path_info $2;
                }
                #配置fastcgi的一些参数
                fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
                fastcgi_param SCRIPT_NAME $real_script_name;
                fastcgi_param PATH_INFO $path_info;
                ###pathinfo支持end
            fastcgi_intercept_errors on;
            fastcgi_pass   127.0.0.1:9000;
        }
        
        location ^~ /data/runtime {
    return 404;
        }
        location ^~ /application {
    return 404;
        }
        location ^~ /simplewind {
    return 404;
        }
    }
    ---------------
    官方文件:
    # 本文件是nginx的配置文件。
    # 根据需要修改下面的域名与目录
    # 通常放置在/etc/nginx/conf.d下

    server {
            listen       80;
            #域名设置
            server_name  thinkcmf.com;
            #项目目录
            root         /www/thinkcmf/public;

            index index.php;

            location / {

                if (!-e $request_filename) {

                    rewrite  ^(.*)$  /index.php?s=$1  last;

                    break;
                }
            }
            location ~ .php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
            }
        }


    ---------------------
    TP5he TP 3的区别


    普通模式:
    http://lh.thinkcmf5.nd.com?g=portal&m=page&a=index&id=32
    注意:5.0取消了URL模式的概念,并且普通模式的URL访问不再支持,但参数可以支持普通方式传值


    PATH_INFO 模式:
    http://lh.thinkcmf5.nd.com/portal/page/index/id/32

    如果不支持PATHINFO的服务器可以使用兼容模式访问如下:
    http://lh.thinkcmf5.nd.com/?s=portal/page/index&id=32
    http://lh.thinkcmf5.nd.com/?s=portal/page/index/id/32
  • 相关阅读:
    java 微信公众号素材 新增其他类型永久素材
    @schedule
    idea 打包的jar运行报 “XXX中没有主清单属性”
    openjdk没有ssl支持的相关证书包,导致使用HTPPS调用第三方接口时候报错误 InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    查询端口是否开通
    企业微信-之无法修改成员手机号
    PostgreSQL使用distinct关键字给单独的几列去重
    centos全屏幕退出:Alt+Enter
    github上OC 和swift框架精选
    github每日精选---iOS版
  • 原文地址:https://www.cnblogs.com/linewman/p/9918727.html
Copyright © 2011-2022 走看看