一、server的配置
server {
listen 80; //代理的端口号(一般是服务器默认的端口号)
server_name luckyxingchen.eu.org; //填写自己的域名
client_max_body_size 1024M;
root /www/wwwroot/project/views/dist; //nginx代理进来后首先找到这个文件下面的html(前端打包后)
index index.html index.htm; //自动访问格式文件
location /my/ { //nginx代理后端在接口找到/my/就直接分发到http://127.0.0.1:9090/这个端口
proxy_pass http://127.0.0.1:9090/;//后端项目端口
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}