一、安装配置nginx
1、安装:
sudo apt-get update sudo apt-get install nginx
2、查看状态
sudo systemctl status nginx
3、开通防火墙端口
4、停止/开启nginx服务
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl restart nginx
sudo systemctl reload nginx
二、将angular项目打包部署到nginx
1、angular项目打包:ng build,将dist目录下的所有文件拷贝到/usr/share/nginx/html
2、找到nginx的配置文件,修改
http{
...
server {
listen 4200;
server_name localhost;
location / {
root html/dash;
index index.html index.html;
}
}
...
}
3、重新启动nginx