nginx安装
要添加CentOS EPEL仓库,终端使用yum命令安装,直接复制执行:
sudo yum -y install epel-release
安装nginx
sudo yum -y install nginx
启动nginx
sudo systemctl start nginx
设置防火墙
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
nginx配置文件地址
cd /etc/nginx/
nginx配置
root /root/fontpage/dist/;
index index.html index.htm;
}
若要配置多个前端则后面的就不用root了,用别名
location /management{
alias /root/fontpage/manage/;
index index.html index.htm;
}
配置请求转发
location /dev-api/{
proxy_pass http://ip:端口/;
}