部署项目的细节可以看这个,传送门centos 7部署laravel项目
主机ip:192.168.10.17
composer create-project --prefer-dist laravel/laravel deploy
# cd deploy composer install
额,刚发现laravel版本竟然是6.6了,迭代很快呀。
修改配置
# cd deploy # vi .env app_name=deploy app_url=http://dev.deploy.goods
php artisan key:generate # 生成key chmod -r 0777 storage # 日志
设置nginx config配置
server { listen 80; server_name dev.deploy.goods; index 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; } }
重启下nginx
项目在虚拟机上,还要配置下win的hosts
192.168.10.17 dev.deploy.goods
打开http://dev.deploy.goods/ 部署成功。
我们可以将虚拟机的工作区挂载到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上
如对本文有疑问, 点击进行留言回复!!
Spring Cloud Alibaba系列,nacos作为服务配置中心
Spring Cloud Alibaba系列(一)nacos作为服务注册中心
网友评论