小程序Android可以请求,ios请求失败wx.request

时间:2022-07-22
本文章向大家介绍小程序Android可以请求,ios请求失败wx.request,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

一、发现问题

1、Android手机可以正常显示所有小程序页面

①页面中----第三方服务器链接的页面http导图可以正常显示

② 页面中----wx.request第三方服务器的https数据可以正常提取

2、ios手机不能显示小程序所有页面

①页面中----第三方服务器链接的http导图可以正常显示

②页面中----wx.request第三方服务器的https数据无法提取

二、分析问题

1、由于微信小程序的第三方服务器链接的图片都可以正常显示

2、明确问题,应该是ios在wx.request对接中受到限制

三、明确问题

判断是SSL证书有问题,但证书状态完全正常,小程序后台的安全域名也添加的没问题,最后解决办法是:换了一家SSL证书,并重启Nginx

四、重启nginx

* Socket connection established *

[root@VM_0_8_centos ~]# cd..
-bash: cd..: command not found
[root@VM_0_8_centos ~]# cd ..
[root@VM_0_8_centos /]# cd /home/443
[root@VM_0_8_centos 443]# ./run.sh
stop application
kill 18683
start application
[root@VM_0_8_centos 443]# nohup: appending output to ‘nohup.out’

[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# systemctl status nginx
● nginx.service - LSB: starts the nginx web server
   Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
   Active: active (running) since Fri 2020-01-10 23:38:40 CST; 6 months 11 days ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/nginx.service
           ├─29864 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
           ├─29865 nginx: worker process
           └─29866 nginx: cache manager process
           
           
           
           
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# 
root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# * Connection closed *
* Socket connection established *


[root@VM_0_8_centos ~]# 
[root@VM_0_8_centos ~]# 
[root@VM_0_8_centos ~]# cd ..
[root@VM_0_8_centos /]# cd
[root@VM_0_8_centos ~]# ls
etc                                           mysql57-community-release-el7-8.noarch.rpm.2  mysql57-community-release-el7-8.noarch.rpm.6
flush                                         mysql57-community-release-el7-8.noarch.rpm.3  quit
mysql57-community-release-el7-8.noarch.rpm    mysql57-community-release-el7-8.noarch.rpm.4  UPDATE
mysql57-community-release-el7-8.noarch.rpm.1  mysql57-community-release-el7-8.noarch.rpm.5  wget-log
[root@VM_0_8_centos ~]# cd /home
[root@VM_0_8_centos home]# ls
443  80  qcl80.jar  www
[root@VM_0_8_centos home]# cd /443
-bash: cd: /443: No such file or directory
[root@VM_0_8_centos home]# cd /443
-bash: cd: /443: No such file or directory
[root@VM_0_8_centos home]# cd ..
[root@VM_0_8_centos /]# ls
bin   data  etc   install.sh  lib64       media  opt    proc  run   srv  tmp  var
boot  dev   home  lib         lost+found  mnt    patch  root  sbin  sys  usr  www
[root@VM_0_8_centos /]# cd /home/443
[root@VM_0_8_centos 443]# ls
nohup.out  qcl443.jar  run.sh  start.sh  stop.sh
[root@VM_0_8_centos 443]# 
[root@VM_0_8_centos 443]# cd ..
[root@VM_0_8_centos home]# cd ..
[root@VM_0_8_centos /]# ls
bin   data  etc   install.sh  lib64       media  opt    proc  run   srv  tmp  var
boot  dev   home  lib         lost+found  mnt    patch  root  sbin  sys  usr  www
[root@VM_0_8_centos /]# cd /www
[root@VM_0_8_centos www]# ls
backup  Recycle_bin  server  swap  wwwlogs  wwwroot
[root@VM_0_8_centos www]# cd /server/nginx
-bash: cd: /server/nginx: No such file or directory
[root@VM_0_8_centos www]# cd /server
-bash: cd: /server: No such file or directory
[root@VM_0_8_centos www]# cd /server/nginx/sbin
-bash: cd: /server/nginx/sbin: No such file or directory
[root@VM_0_8_centos www]# ls
backup  Recycle_bin  server  swap  wwwlogs  wwwroot
[root@VM_0_8_centos www]# cd /server
-bash: cd: /server: No such file or directory
[root@VM_0_8_centos www]# cd ..
[root@VM_0_8_centos /]# ls
bin   data  etc   install.sh  lib64       media  opt    proc  run   srv  tmp  var
boot  dev   home  lib         lost+found  mnt    patch  root  sbin  sys  usr  www
[root@VM_0_8_centos /]# cd /www/server/nginx/sbin
[root@VM_0_8_centos sbin]# ls
nginx
[root@VM_0_8_centos sbin]# ./nginx -t
nginx: the configuration file /www/server/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /www/server/nginx/conf/nginx.conf test is successful
[root@VM_0_8_centos sbin]# ls
nginx
[root@VM_0_8_centos sbin]# ./nginx -s reload
[root@VM_0_8_centos sbin]# ls
nginx
[root@VM_0_8_centos sbin]# cd ..
[root@VM_0_8_centos nginx]# * Connection closed *
* Socket connection established *


[root@VM_0_8_centos ~]# cd ..
[root@VM_0_8_centos /]# cd /home/443
[root@VM_0_8_centos 443]# systemctl status nginx
● nginx.service - LSB: starts the nginx web server
   Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
   Active: active (running) since Fri 2020-01-10 23:38:40 CST; 6 months 11 days ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/nginx.service
           ├─17125 nginx: worker process
           ├─17126 nginx: cache manager process
           └─29864 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
[root@VM_0_8_centos 443]# cd ..
[root@VM_0_8_centos home]# cd ..
[root@VM_0_8_centos /]# ls
bin   data  etc   install.sh  lib64       media  opt    proc  run   srv  tmp  var
boot  dev   home  lib         lost+found  mnt    patch  root  sbin  sys  usr  www
[root@VM_0_8_centos /]# cd /www/server/nginx/sbin
[root@VM_0_8_centos sbin]# ps -er|grep nginx
20852 pts/0    R+     0:00 ps -er XDG_SESSION_ID=539093 HOSTNAME=VM_0_8_centos TERM=vt100 SHELL=/bin/bash HISTSIZE=3000 SSH_CLIENT=111.230.154.177 57196 22 OLDPWD=/ SSH_TTY=/dev/pts/0 USER=root LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36: MAIL=/var/spool/mail/root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin PWD=/www/server/nginx/sbin LANG=en_US.utf8 SHLVL=1 HOME=/root LOGNAME=root SSH_CONNECTION=111.230.154.177 57196 172.21.0.8 22 LESSOPEN=||/usr/bin/lesspipe.sh %s PROMPT_COMMAND=history -a;  XDG_RUNTIME_DIR=/run/user/0 LE_WORKING_DIR=/root/.acme.sh HISTTIMEFORMAT=%F %T  _=/usr/bin/ps
[root@VM_0_8_centos sbin]# ps -ef|grep nginx
www       7417     1  0  2019 ?        00:02:04 nginx: cache manager process
www      17125 29864  0 00:43 ?        00:00:00 nginx: worker process
www      17126 29864  0 00:43 ?        00:00:00 nginx: cache manager process
root     21005 19839  0 01:10 pts/0    00:00:00 grep --color=auto nginx
root     29864     1  0 Jan10 ?        00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
[root@VM_0_8_centos sbin]# kill -HUP 7417
[root@VM_0_8_centos sbin]# ps -ef|grep nginx
www       7417     1  0  2019 ?        00:02:04 nginx: cache manager process
www      17125 29864  0 00:43 ?        00:00:00 nginx: worker process
www      17126 29864  0 00:43 ?        00:00:00 nginx: cache manager process
root     21290 19839  0 01:12 pts/0    00:00:00 grep --color=auto nginx
root     29864     1  0 Jan10 ?        00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
[root@VM_0_8_centos sbin]# kill -HUP 29864
[root@VM_0_8_centos sbin]# kill -HUP
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
[root@VM_0_8_centos sbin]# ps -ef|grep nginx
www       7417     1  0  2019 ?        00:02:04 nginx: cache manager process
www      21439 29864  0 01:13 ?        00:00:00 nginx: worker process
www      21440 29864  0 01:13 ?        00:00:00 nginx: cache manager process
root     21534 19839  0 01:14 pts/0    00:00:00 grep --color=auto nginx
root     29864     1  0 Jan10 ?        00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
[root@VM_0_8_centos sbin]# kill -TERM 7417
[root@VM_0_8_centos sbin]# ps -ef|grep nginx
www      21439 29864  0 01:13 ?        00:00:00 nginx: worker process
www      21440 29864  0 01:13 ?        00:00:00 nginx: cache manager process
root     21986 19839  0 01:17 pts/0    00:00:00 grep --color=auto nginx
root     29864     1  0 Jan10 ?        00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
[root@VM_0_8_centos sbin]# kill -TERM 21439
[root@VM_0_8_centos sbin]# kill -TERM 21440
[root@VM_0_8_centos sbin]# kill -TERM 21534
-bash: kill: (21534) - No such process
[root@VM_0_8_centos sbin]# ps -ef|grep nginx
www      22100 29864  0 01:17 ?        00:00:00 nginx: worker process
www      22137 29864  0 01:17 ?        00:00:00 nginx: cache manager process
root     22250 19839  0 01:18 pts/0    00:00:00 grep --color=auto nginx
root     29864     1  0 Jan10 ?        00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
[root@VM_0_8_centos sbin]# kill -TERM 29864
[root@VM_0_8_centos sbin]#  ps -ef|grep nginx
root     22394 19839  0 01:19 pts/0    00:00:00 grep --color=auto nginx
[root@VM_0_8_centos sbin]# ps -ef|grep nginx
root     22439 19839  0 01:20 pts/0    00:00:00 grep --color=auto nginx
[root@VM_0_8_centos sbin]# kill -TERM 22439
-bash: kill: (22439) - No such process
[root@VM_0_8_centos sbin]# ls
nginx
[root@VM_0_8_centos sbin]# ./nginx -t
nginx: the configuration file /www/server/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /www/server/nginx/conf/nginx.conf test is successful
[root@VM_0_8_centos sbin]# ./nginx -s reload
nginx: [error] invalid PID number "" in "/www/server/nginx/logs/nginx.pid"
[root@VM_0_8_centos sbin]# ./nginx -s reload
nginx: [error] invalid PID number "" in "/www/server/nginx/logs/nginx.pid"
[root@VM_0_8_centos sbin]# * Connection closed *
* Socket connection established *


[root@VM_0_8_centos ~]# cd /www/server/nginx/sbin
[root@VM_0_8_centos sbin]# ./nginx -s reload 
nginx: [error] invalid PID number "" in "/www/server/nginx/logs/nginx.pid"
[root@VM_0_8_centos sbin]# /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf
[root@VM_0_8_centos sbin]# ./nginx -s reload 
[root@VM_0_8_centos sbin]# * Connection closed *

参考链接:https://blog.csdn.net/lily_YourSun/article/details/90719991

https://blog.csdn.net/zxh1220/article/details/82725543?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.nonecase

https://developers.weixin.qq.com/community/develop/doc/da6f40cfc4a93327804e3a97c83aa7e7?_at=1565133738599

重启nginx有关问题的参考链接:

https://www.cnblogs.com/codingcloud/p/5095066.html

https://www.jianshu.com/p/165c5672414b

https://www.cnblogs.com/link01/p/12050567.html