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
  • 相关阅读:
    [转]SVN服务器搭建和使用(二)
    [转]SVN服务器搭建和使用(一)
    BZOJ 2049 Sdoi2008 Cave 洞穴勘测
    BZOJ 1589 Usaco2008 Dec Trick or Treat on the Farm 采集糖果
    BZOJ 2796 POI2012 Fibonacci Representation
    BZOJ 2115 Wc2011 Xor
    BZOJ 3105 CQOI2013 新Nim游戏
    BZOJ 2460 Beijing2011 元素
    BZOJ 3687 简单题
    BZOJ 1068 SCOI2008 压缩
  • 原文地址:https://www.cnblogs.com/linewman/p/9918727.html
Copyright © 2011-2022 走看看