部署项目的细节能够看这个,传送门Centos 7部署Laravel项目php
主机IP:192.168.10.17html
【高可用架构】系列连接:待部署的架构介绍nginx
composer create-project --prefer-dist laravel/laravel Deploy
# cd Deploy composer install
额,刚发现Laravel版本居然是6.6了,迭代很快呀。laravel
修改配置git
# cd Deploy # vi .env APP_NAME=Deploy APP_URL=http://dev.deploy.goods
php artisan key:generate # 生成Key chmod -R 0777 storage # 日志
设置Nginx config配置github
server { listen 80; server_name dev.deploy.goods; index index.html index.htm index.php; location / { rewrite ^/(.*)$ /index.php/$1 last; try_files $uri $uri/ /index.php?$query_string; } location ~ (.+\.php)(.*)$ { root "/var/www/Deploy/public"; fastcgi_split_path_info ^(.+\.php)(.+)$; fastcgi_pass unix:/var/run/php-fpm/php7-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; } }
重启下nginxweb
项目在虚拟机上,还要配置下win的hosts服务器
192.168.10.17 dev.deploy.goods
打开http://dev.deploy.goods/ 部署成功。php7
咱们能够将虚拟机的工做区挂载到win下,传送门Centos7安装Samba并将工做区挂载到win,固然也能够直接用vi架构
打开Deploy/routes/web.php
Route::get('/', function () { $data = ['server_ip' => $_SERVER['SERVER_ADDR']]; return view('welcome', $data); });
打开Deploy/resources/views/welcome.blade.php,修改84行
IP:{{ $server_ip }}
刷新http://dev.deploy.goods/
这步看概述里面的传送门,这里就不写了,仓库名为Deploy
下一章咱们开始用官网的Envoy工具,将Deploy项目统一部署到两台APP Server上