在阿里云安全组与宝塔安全放开8081端口
server {
listen 8081;
server_name www.whxyyds.top;
charset utf-8;
location / {
root /home/ruoyi/projects/ruoyi-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8083/;
}
}
listen 与 server_name组织共同拦截 如上代码既是拦截 www.whxyyds.top:8081;
拦截到文件 root (目录) index (目录下文件);
拦截到其他端口 proxy_pass ;
listen 监听端口不允许是服务器中已起服务端口