nginx支持TP框架配置的nginx.conf

nginx支持Thinkp的配置文件

server {
        listen       8082;
        server_name  localhost;
        charset utf-8;
        access_log  logs/host.access.log  main;
        root /var/www/html/thinkphp/public;
        index  index.html index.htm index.php;
        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   127.0.0.1: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|flv|ico)$ {
            expires 30d;
            access_log off;
        }
        location ~ .*\.(js|css)?$ {
            expires 7d;
            access_log off;
       }
}

注意:在TP框架的配置文件中一定要加上‘URL_MODEL’=>2

在入口文件中加上 define('__APP__','');

在linux下一定要注意大小写

你可能感兴趣的:(nginx支持TP框架配置的nginx.conf)