//nginx.conf 中 server 中配置
server {
liseten 3000; #nginx 服务端口;
server_name localhost;
location / {
root html/url #网站根目录
index index.html index.html #默认首页文件
proxy_pass http:localhost:3000/ #转发到的本地服务;
}
location ^~/rest/testurl/ #接口请求转发到服务可以定义多个
{
proxy_pass https://xx.xx.xx:8080 #转发的服务地址 即后端服务地址
}
}
nginx详细配置参考地址:https://www.zhangxinxu.com/sp/icon/css.php
前后端分离 用nginx反向代理联调
最新推荐文章于 2024-05-14 16:42:12 发布