nginx + springboot 配置

1、spring boot 访问地址http://localhost:13000/test/hello

2、配置nginx.conf文件

upstream my_ngix {

  server localhost:13000;
 }

server {
  listen 8010;
  server_name localhost;

  location ^~ /test/hello/ {
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_pass http://my_ngix/test/hello/;
  }
}

nginx -s reload :重启

start nginx : 启动ngnix

nginx -t :检查 nginx.conf配置文件语法

nginx -s stop : 停止

原文地址:https://www.cnblogs.com/langdangyunliu/p/9548414.html