• 使用 nginx 实现前(Angular)后(Springboot)端分离 并代理为一个网站


    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

     

  • 相关阅读:
    css位置相关元素
    用smarty模板做的登录
    时间查询插件
    smarty 总结和分析
    手风琴特效
    Mysql 知识点总结
    Javascript实现图片的预加载的完整实现
    phpcms 列表页中调用其下的所有子栏目(或特定的子栏目)的方法
    phpcms v9表单实现问答咨询功能
    Cocos2d-x学习之 整体框架描述
  • 原文地址:https://www.cnblogs.com/xiaoruilin/p/14265494.html
Copyright © 2020-2023  润新知