Jenkins
1.git拉取代码
2.执行shell构建
npm cache clean -f
npm install --registry=https://registry.npm.taobao.org
./node_modules/.bin/ng build --prod --aot
3.通过ssh上传代码到远程云服务器
Nginx
1.下载Nginx
$ sudo apt-get update
$ sudo apt-get install nginx
2.打开默认配置文件
sudo vi /etc/nginx/sites-available/default
3.清空配置文件并copy以下内容
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ /index.html =404;
}
}
4.重启Nginx
sudo systemctl restart nginx
5.检查Nginx运行状态,如果显示绿色的“active”和其他信息说明运行成功
sudo systemctl status nginx