Win7下Laravel簡單安裝
阿新 • • 發佈:2019-01-08
前置條件:已經在系統中安裝好Composer、PHPStudy2017,nginx+7.0且已正常執行
一、安裝
命令提示符中,>d:
>cd data\www
>composer global require "laravel/installer"
>laravel new laravel
(第一個laravel是命令,第二個laravel是目錄,我在d:\data\www下使用laravel命令新建一個叫laravel的專案,非常漫長,建議連上VPN後再用這個命令)
出現瞭如下提示表示安裝成功
二、基本配置 然後設定PHPStudy2017中的host www.laralvel.local,
新增一行
127.0.0.1 www.laravel.local
然後在nginx中新增配置
然後設定\storage、\bootstrap\cache為users完全控制權限#laravel server { listen 80; server_name www.laravel.local; root "d:/data/www/laravel/public"; index index.html index.htm index.php; error_page 404 /404.html; location = /404.html { return 404 'Sorry, File not Found!'; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; # windows dir } location / { try_files $uri $uri/ /index.php?$query_string; } location ~ /Uploads/.*\.php$ { deny all; } location ~ \.php/ { if ($request_uri ~ ^(.+\.php)(/.+?)($|\?)) { } fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_NAME $1; fastcgi_param PATH_INFO $2; fastcgi_param SCRIPT_FILENAME $document_root$1; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }
然後可以在config/app.php中配置時區等
'url' => env('APP_URL', 'http://www.laravel.local'),
'timezone' => 'Asia/Shanghai',
'locale' => 'zh',
'fallback_locale' => 'zh',
訪問http://www.laravel.local可以看到laravel已經工作了