把前端服务打的包取名字放到nginx-1.22.0\html目录下,通过conf中的代理访问前端页面
在nginx.conf中,配置监听端口,默认80(访问时可不加端口),可以配置监听多个端口
server {
listen 8222;
server_name localhost;
//Manager 名字为浏览器访问地址,会映射到下方html文件夹中的Manager目录
location /Manager {
alias E:/development_tools/nginx-1.22.0/html/Manager;
}
location /Guide {
alias E:/development_tools/nginx-1.22.0/html/Guide;
}
location / {
//这个为后台服务的真实的IP地址+端口,上面的前端服务都会访问这个后端ip
proxy_pass http://127.0.0.1:8928;
}
}
server {
listen 8221;
server_name localhost;
location /Server {
alias E:/development_tools/nginx-1.22.0/html/Server;
}
location / {
proxy_pass http://127.0.0.1:8927;
}
}