用腾讯"云开发"的http API,须要跨域请求。html
开发环境用的vue的axios作的代理,生成环境用Nginx的反向代理作vue
如下为Nginx目录中nginx.conf配置文件server部分ios
server { listen 5188; // 端口 server_name localhost; // 主机名 location / { root /Users/renliquan/healthAdmin; // 主目录(网站路径) index index.html; // 默认页面 } // 访问localhost:5188/api/tcb/ 代理到https://api.weixin.qq.com/tcb/ location /api/tcb/ { proxy_pass https://api.weixin.qq.com/tcb/; } // 同上规则 location /api/cgi-bin/token { proxy_pass https://api.weixin.qq.com/cgi-bin/token; } }