获取微信用户授权信息,先在公众号平台设置网页授权域名。
先将txt文件下载并上传到服务器某个目录下。nginx安装完成,并修改nginx.conf配置文件如下:
upstream www.yiqihoo.com{
server 127.0.0.1:8080;
}
server {
listen 80;
server_name www.yiqihoo.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
# proxy_pass http://www.yiqihoo.com;
root /home/lishuaikang/packs/wxpay/;
# index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
刚开始 # proxy_pass http://www.yiqihoo.com;并未注释,在公众号后台输入域名后点击确定按钮有错误提示。
注释掉重启nginx,域名设置成功。