Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a local debugging environment in Wechat development

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to build a local debugging environment in Wechat development". The content is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "how to build a local debugging environment in Wechat development".

The local debugging developed by Wechat only supports port 80. Many methods have been tested, so let's sum up:

Method 1:

The company uses Unicom ADSL, and after doing port mapping on the router, it is found that China Telecom / Unicom has blocked port 80, so this method can not work.

Method 2:

Search can be the following, you can use ngrok, fast download, set up. When you enter the URL of ngrok into the Wechat setting, Wechat indicates that this kind of URL has a security risk and is no longer supported.

Method 3:

This method requires you to have an extranet linux server. Wechat requires that the domain name of this machine is already registered through ICP, and you can use a subdomain name of your development domain name to point to this server. Like http://wechatdev.yourdomain.com.

(1) first of all, turn off the service of the linux server occupying port 80.

(2) turn on the remote forwarding function of the server and execute the following command:

Sudo nano / etc/ssh/sshd_config

Add a sentence at the end of the / etc/ssh/sshd_config file:

GatewayPorts yes

Then restart SSH:sudo service ssh restart

After trying the Linux virtual machine of Aliyun and Azure, you should pay attention to the following:

Ali Yun

Open the firewall and allow access to port 80

Azure:

Open the firewall and allow access to port 80

What makes Azure more special than Aliyun is that root users do not open it by default. All we need to open root users

Log in with SSH, and you should have a user when you create a virtual machine.

Execute the following command:

Sudo nano / etc/ssh/sshd_config

Modify

PermitRootLogin without-password

Are:

# PermitRootLogin without-password (commented out)

PermitRootLogin yes

Then restart SSH:

Sudo service ssh restart

Then switch to the root user

Sudo su

Check whether the root user is locked (LOCK indicates locked)

[root@Linux ~] # grep root / etc/shadow

Root:*LOCK*:14600:

Give root a password so that root is enabled

[root@Linux ~] # passwd

The last step is to set up port forwarding to run on the local machine (assuming you use MAC):

Ssh-R 80:localhost:9001 root@wechatdev.yourdomain.com (this means that all traffic destined for wechatdev.yourdomain.com:80 is forwarded to local port 9001.

These are all the contents of this article entitled "how to build a local debugging environment in Wechat development". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report