Nginx配置微信小程序校验

Nginx配置微信小程序校验

  • Centos7的配置
  • Ubuntu 的配置

情况说明:工作中开发环境,前端需要接入微信小程序认证,进入Nginx配置文件进行配置,记录过程

Centos7的配置

# 版本详情
CentOS Linux release 7.7.1908 (Core)

nginx version: nginx/1.16.1

# 进入nginx子配置文件
cd /etc/nginx/conf.d

vim wechat_auth.conf
server {
    listen       80;
    server_name  pakho.com;

    location /37og2Z5TwR.txt {
                default_type    text/html;
                return 200 "6831c2a15d3d103c6a1ff356b22b5";
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

Ubuntu 的配置

# 版本详情
Linux version 4.14.105-19-0012 ([email protected]) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC)) 

nginx version: nginx/1.14.0 (Ubuntu)

vim /etc/nginx/nginx.conf

        # Virtual Host Configs
        ##
server {
	listen       80;
	server_name  pakho.com;

	location /37og2Z5TwR.txt {
				default_type    text/html;
                        return 200 "6831c2a15d3d103c6a1ff356b22b5";
	}
}

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

配置完成后进入腾讯云负载均衡配置,域名+/37og2Z5TwR.txt,加入后端realServer

你可能感兴趣的:(#,Nginx,nginx,微信小程序,linux)