1. 程式人生 > >lnmp 部署tp5項目文件

lnmp 部署tp5項目文件

部署 and 服務 ram list http php5 div home

1,把thinkphp5解壓

2,添加配置項,項目路徑和域名

  nginx.config 或者自定義的main.config下加如下配置代碼

  重啟服務器

server {
    listen       80;
    server_name  hwl.tptest.com; 
    #root   /home/wwwroot/;
    set $root /home/wwwroot;

location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ 
    {
       expires      30d;
       access_log   off;
    }

   location 
/ { root $root; index index.html index.htm index.php; if ( -f $request_filename) { break; } if ( !-e $request_filename) { rewrite ^(.*)$ /index.php/$1 last; break; } } location ~ \.php/?.* { set $script
$uri; set $path_info ""; if ($uri ~ "^(.+\.php)(/.+)") { set $script $1; set $path_info $2; } fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php?IF_REWRITE=1; # include fastcgi.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO
$path_info; fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $script; include fastcgi_params; } }

3,出錯了

技術分享

技術分享

刪掉scandir函數

技術分享

保存並重啟nginx

4,輸入路由

http://hwl.tptest.com/tptest/public/index.php/index/Index/index

技術分享

lnmp 部署tp5項目文件