TP框架在nginx的服务器下的一些简单配置

  • A+
所属分类:Nginx PHP
server { 
                listen       80;
                server_name www.itdata.top;
                index  index.php index.html index.htm;
                root /home/wwwroot/itdata/tp5/public;
                
                location / {
                        if (!-e $request_filename) {
                                rewrite ^(.*)$ /index.php?s=$1 last;
                                break;
                        }
                }
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                        root   html;
                }
 
                location ~ [^/]\.php(/|$) {
                   fastcgi_pass   unix:/tmp/php-cgi.sock;
                   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|flv|ico)$ {
                        expires 30d;
                        access_log off;
                }
                location ~ .*\.(js|css)?$ {
                        expires 7d;
                        access_log off;
               }
  }

 

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信小程序
  • 我的微信小程序扫一扫
  • weinxin
Lion

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: