安装Laravel5.2


通过 Composer 创建项目并自动下载Laravel框架

composer自动下载

composer create-project --prefer-dist laravel/laravel laravel5

以上则已经为我们下载好了laravel框架,如果顺利应该继续往下执行并安装其他依赖。
安装过程中可能报错,因为composer走的国外地址可能被墙。
以下为报错信息:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info


  [Composer\Downloader\TransportException]                                     
  Your configuration does not allow connections to http://87.98.253.214/p/ill  
  uminate/view%24f06379e582a0ee5b7494171c9c44e516d815e139340df69ddd0df30a834c  
  9079.json. See https://getcomposer.org/doc/06-config.md#secure-http for det  
  ails.                                                                        


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

解决方法:更换网络节点,或者使用vpn。
在已下载下来的(laravel5.2)项目中执行 composer update 或者 composer install

nginx 配置

server {
    listen       80;
    server_name  laravel;
    root /Users/wenji/project/laravel5.2/public;
    index  index.html index.htm index.php;

    access_log  /Users/wenji/project/logs/laravel5.2_access.log;

    # php rewrite
    location / {

    try_files $uri $uri/ /index.php?$query_string;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    error_log  /Users/wenji/project/logs/laravel_error.log;
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

随机字串作为应用的秘钥(key)
php artisan key:generate
这个 key 还可以在 .env 环境配置文件中设置

➜  laravel5.2 git:(master) php artisan key:generate
Application key [base64:66bDiQEpVqzyL6CsWBcIN5IYnJHa3vqezUtph+hHGXc=] set successfully.

results matching ""

    No results matching ""