解决vuejs项目nginx线上部署 微信登录跨站问题

解决vuejs项目nginx部署 微信登录跨站问题

 

tips: 跨站错误  微信登录跨站问题

 

# 在根目录下吗,刷新时候出现404的问题

location / {

    try_files $uri $uri/ /index.html;

    index /index.html;

  }

 

# 在二级目录下面,刷新时候出现404的问题

  location ^~/wxlogin/ {

    alias /data/wwwroot/login/;

    #index index.html;

    try_files $uri $uri/ @rewrites;

  }

  location @rewrites{

    rewrite ^/(login)/(.+)$ /$1/index.html last;

  }


 

# 微信登录 提示跨站错误  跨站代理 

 

 location ^~/api/{

    proxy_pass https://接口地址的域名/app.php/api/;     # 接口访问地址

  }
  location ^~/sns/{

    proxy_pass https://api.weixin.qq.com/sns/;    #微信登录

  }

 

你可能感兴趣的:(vue)