laravel 写blog (一安装laravel环境)

1.在github新建blog项目

2.命令行到项目 文件夹  https://github.com/laravel/laravel.git 

3.文件名改为blog

4.composer-json 文件 末尾添加

{"repositories": {
    "packagist": {
      "type": "composer",
      "url": "https://packagist.laravel-china.org"
    }
  }
}

4.composer install 安装laravel 依赖包

5.配置nginx.conf 

server {
    listen       80;
    server_name  www.myblog.com;
    root   "D:/myphp_www/PHPTutorial/WWW/blog/public";

      location / {
          index  index.html index.htm index.php;
          if (!-e $request_filename) {
                rewrite ^/(.*)$ /index.php/$1 last; 
            }
          #autoindex  on;
      }
      
      location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            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;
      }
   }     

6.复制 .env.example 为.env 

7.php artisan key:generate 

这是后可以访问laravel了 

 

 8.适配phpunit

  在composer.json script里添加

  "test":[
            "vendor\\bin\\phpunit"
        ],
php composer test 成功

9.与远程git仓挂钩 上传到git

 删除.git 文件(删除原来的git)

git init

git remote add origin git@githbub.com:V-DIKO/blog

git add .

git commit -m 'first-commit'

上传成功




posted on 2019-05-07 12:16  diko  阅读(87)  评论(0)    收藏  举报