后台微信微博请求通过nginx代理服务器转发
来源:本站原创
点击数: 次
发布时间:2025年03月07日
问题描述:
后台服务器在内网环境,需要通过nginx服务器代理转发微信微博请求
解决办法:
前提条件:
1.nginx服务器可以访问微信微博接口地址;
2.后台服务器可以访问nginx服务器的某端口(例如8080)。
微信微博功能后台配置:
这两处在当前公版中都无法代理,需要开发更新程序后方可配置。
nginx相关配置:
#转发微信
server {
listen 8080;
server_name api.weixin.qq.com;
location / {
proxy_pass https://api.weixin.qq.com;
include /etc/nginx/conf/conf.d/proxy.conf;
}
}
#转发微博
server {
listen 8080;
server_name api.weibo.com;
location / {
proxy_pass https://api.weibo.com;
include /etc/nginx/conf/conf.d/proxy.conf;
}
}
后台相关配置:
把/etc/hosts文件中写上
172.0.x.x api.weixin.qq.com
172.0.x.x api.weibo.com