• nginx上布置thinkphp


    thinkphp config配置:

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

    nginx rewrite配置:

    location / {
            set $static 0;
            if  ($uri ~ .(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css.map|min.map)$) {
                            root    /data/www;
                            set $static 1;
            }
            if (!-e $request_filename){
                            set $static 0$static;
            }
            if ($static = 00){
                            rewrite  ^/(.*)$  /index.php?s=$1  last;
            }
    }

    如果你的ThinkPHP安装在二级目录,Nginx的伪静态方法设置如下,其中youdomain是所在的目录名称

    location /yourdomain/ {
            set $static 0;
            if  ($uri ~ .(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css.map|min.map)$) {
                            root    /data/www;
                            set $static 1;
            }
            if (!-e $request_filename){
                            set $static 0$static;
            }
            if ($static = 00){
                            rewrite  ^/yourdomain/(.*)$  /yourdomain/index.php?s=$1  last;
            }
    }
  • 相关阅读:
    基于Html5的移动应用开发经验总结:第一篇架构选型篇(下)
    401 Palindromes 解题报告
    uva 537 Artificial Intelligence?
    根据所给的年月,打印该月份的日历表
    八皇后问题
    uva10815 Andy's First Dictionary
    憋了我半天,写个博客发泄一下
    uva 457
    uva 10010 Where's Waldorf?
    uva424 Integer Inquiry
  • 原文地址:https://www.cnblogs.com/wuxie1989/p/5482608.html
Copyright © 2020-2023  润新知