账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    关于vue项目在生产环境中nginx的配置问题
    40
    0

    我在前端设置了反向代理代码如下

    proxyTable: {
      '/API':{
        target: 'http://dev.snhb.group:9090',
       // target: '192.168.31.110:9090',
        changeOrigin: true,
        secure: false,
        pathRewrite: {
          '^/API':'/'
        }
      }
    },
    
    这是请求:
    export function listLineSelect() {
    return request({
        url: '/API/pcms/pcms/alarm/listAllLine',
        method: 'post',
        baseURL: '',
        params: {}
    })

    }

    开发环境是没有问题的
    但是在生产环境遇到了这样的问题
    Request URL: http://localhost:9090/API/pcms/security/sso/ajaxcheck?account=gmservice&password=123546
    Request Method: POST
    Status Code: 404
    Remote Address: 127.0.0.1:9090
    Referrer Policy: no-referrer-when-downgrade

    我想变成这样的请求http://localhost:9090/pcms/security/sso/ajaxcheck?

    所以我尝试在nginx进行了如下配置
    server {

        listen       9090;
        server_name  localhost;
    
        #charset koi8-r;
    
        #access_log  logs/host.access.log  main;
        
        location ~* /api/ {
            proxy_pass  http://dev.snhb.group:9090;
            root   html;
            index  index.html index.htm;
        }
        

    并没得用。不知道大家有没有好办法呢。。谢谢了

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 长梦霜歌 超级管理员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部