zoukankan      html  css  js  c++  java
  • Nginx部署ThinkPHP项目的办法

    thinkphp config配置:

    'URL_MODEL'          => '2', //URL模式

    nginx rewrite配置:

    location / { 
       if (!-e $request_filename) {
       rewrite  ^(.*)$  /index.php?s=$1  last;
       break;
        }
    }
    另一种方法:
    server {
     ...
        location / {
            index  index.htm index.html index.php;
            #如果文件不存在则尝试TP解析
            try_files  $uri  /index.php$uri;
        }
        location ~ .+.php($|/) {
            root        /var/www/html/website;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            
            #设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
            #后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
            fastcgi_split_path_info  ^(.+.php)(/.*)$;
            fastcgi_param  PATH_INFO $fastcgi_path_info;
            
            #加载Nginx默认"服务器环境变量"配置
            include        fastcgi.conf;
        }
    }

  • 相关阅读:
    SQL逻辑查询语句执行顺序
    数据库索引的实现原理
    JAVAMail邮件服务器
    TCP/IP基础
    Java IO流学习总结
    [Lydsy1806月赛] 超速摄像头
    CodeForces
    SCU
    CodeForces
    CodeForces
  • 原文地址:https://www.cnblogs.com/fenle/p/5445192.html
Copyright © 2011-2022 走看看