nginx
server { listen 9191; root E:HelloProjectdist; index index.html index.htm; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #添加头部信息 proxy_set_header Cookie $http_cookie; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location / { proxy_pass http://localhost:9090; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; #重点重定向会导致oAuth2找不到正确的重定向地址 } location /login { try_files $uri $uri/login /login/index.html; } # error_page 500 502 503 504 /50x.html; # location = /50x.html { # root html; # } }
引用:
1、nginx中部署发布angular应用
https://blog.csdn.net/yunfeng482/article/details/87204844
2、SpringBoot 实现前后端分离的跨域访问(Nginx)
https://www.jianshu.com/p/520021853827
3、关于 Nginx 反向代理导致 Spring Boot OAuth2 认证失败的问题
https://blog.csdn.net/github_39939645/article/details/87829944