thinkphp3.2在nginx下的配置

最近一直没用nginx

昨天将tp3.2的项目部署到Ubuntu下的nginx下,发现忘记怎么配置的了

特将配置方式记录下来,以方便日后查找

服务器nignx
配置文件
server {
        listen       8081;
        server_name  XX.XX.XX.XX;  
        root   /www/ppm;
        index index.html index.htm index.php index.nginx-debian.html;
        location / {
            if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php?$1 last;
                break;
            }
            try_files $uri $uri/ =404;
        }
        location ~ \.php(.*)$  {
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            fastcgi_index index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            
            include fastcgi_params;
        }
}

重启nginx

posted @ 2019-04-01 12:52  慕尘  阅读(1287)  评论(0编辑  收藏  举报