thinkphp3.2 在 nginx 下的配置 4年前

需要将ThinkPHP中的url_mode设置为2

server
    {
        listen 80;
        #listen [::]:80;
        server_name XXX.com;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /usr/share/nginx/html/XXX;
        location / {
          if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=$1  last;
           break;
          }
       }
        location ~ \.php {
          #fastcgi_pass 172.17.0.5:9000;
          fastcgi_pass 172.17.0.5: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;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
 
    }

ps:

安装lnmp一键安装包
wget -c http://soft.vpser.net/lnmp/lnmp1.3-full.tar.gz && tar zxf lnmp1.3-full.tar.gz && cd lnmp1.3-full && ./install.sh lnmp

image
浅い
我会死在这里,我的每一寸肌肤都会腐烂,除了…一寸,这一寸,它是那么的小,那么的脆弱,却是这世上唯一值得拥有的东西,我们决不能失去或者放弃它,我们决不能让别人把它夺走。
1
发布数
0
关注者
855
累计阅读

热门教程文档

Redis
14小节
C#
57小节
Dart
35小节
PHP
52小节
Typescript
31小节
广告