默认已拥有域名,且完成相关备案
本期从腾讯云申请SSL证书开始
1、登录腾讯云,搜索SSL,免费申请,如下:
2、假定,已完成ssl证书申请
将申请来的SSL证书,配置到nginx,我这里使用的服务器是 Windows Server,
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server_names_hash_bucket_size 128;
server {
listen 7443 ssl;
server_name 替换成自己的域名;
#日志打印地址
access_log D:/logs/nginx/access.log;
error_log D:/logs/nginx/error.log;
#证书存放地址,我这里ssl文件夹与nginx.conf在同级
ssl_certificate ssl/digital-xxx.com_bundle.crt;
ssl_certificate_key ssl/digital-xxx.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~/jeecg-boot/mes/ {
proxy_pass http://192.168.9.xx:8080/jeecg-boot/;
}
location ^~/jeecg-boot/tpm/ {
proxy_pass http://192.168.9.xx:8085/jeecg-boot/;
}
location ^~/jeecg-boot/ {
proxy_pass http://192.168.9.xx:8080/jeecg-boot/;
}
client_max_body_size 20m; # 客户端上传文件大小限制
client_body_buffer_size 512k;
client_header_buffer_size 2k;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 3000;
server_name 替换成自己的域名;
access_log D:/logs/nginx/access.log;
error_log D:/logs/nginx/error.log;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location ^~/jeecg-boot/mes/ {
proxy_pass http://192.168.9.xx:8080/jeecg-boot/;
}
location ^~/jeecg-boot/tpm/ {
proxy_pass http://192.168.9.xx:8085/jeecg-boot/;
}
location ^~/jeecg-boot/ {
proxy_pass http://192.168.9.xx:8080/jeecg-boot/;
}
client_max_body_size 20m; # 客户端上传文件大小限制
client_body_buffer_size 512k;
client_header_buffer_size 2k;
#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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name 192.168.9.125;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
这样配置好之后,我们的域名就变成https安全的了,在这里有几点需要注意的是,ssl证书的存放位置是否指向正确,443端口是否开放
3、当我们配置好域名之后,就来准备小程序的一些配置
将小程序连接后端的地址改为刚刚修改好的域名,值得一提的是,我这里使用的nginx代理到后台
打开微信开发工具(记得选择代码压缩),如下进行质量扫描,并不是全部通过才可以上传,所以我们有时候不要钻牛角尖,因为有些我是真的通过不了,懵懵的
然后点击左上角的上传按钮就可以上传啦,如果没有上传按钮的话,那说明自己appid不对应,自己去微信公众平台查看,然后到项目里修改
4、上传完之后,登录微信公众平台,点击版本管理,就可以在体验版本看到了
5、点击左侧开发管理,找到服务器域名,将自己准备好的域名编辑上,我这里端口是7443,是因为我的默认端口被占用了,有一换成了别的端口,这里配置完域名之后需要等待10-20分钟左右,听说是因为审核或校验或缓存的缘故,反正等一下就行了
6、回到我们的版本管理,用手机测测体验版的是否可以登录,如果可以的话就准备进行提交审核,然后发布吧
7、我出现的问题:
7.1、手机流量登录不进去,连无线网(公司的网络是电信,工厂的专线也是电信,我换过别人的热点,发现也不可登录)就可以登录,原因是这个域名的443端口被占用的,所以我最后切换成了7443端口