English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The latest has been fiddling with the mini-program
I work on both the front-end and back-end together, the front-end does not need to be said to be the WeChat mini-program, and the back-end uses NODEJS.
So let's talk about how to configure HTTPS services for NODEJS
My NODE uses the Express framework
Let's go straight to the code:
The most important few lines of code have been marked out. Everyone should understand after a look.
Before purchasing the certificate, I won't go into detail about applying for the domain name, domain pointing, and resolution, as it is very simple, just search Baidu if you don't know how to do it.
Let's talk about applying for HTTPS certificates on Alibaba Cloud, which is the key and pem part of the above code
1Enter Alibaba Cloud, log in, and find the certificate service in the left menu bar
After entering, click to purchase the certificate
I won't go into detail about the purchase operation, as there are both paid and free options, just choose as you like. Keep clicking next to purchase. Anyway, I chose the free one, hehe
After purchasing, you can see it in my certificate, but you need to complete the information. You can see there is a complete button, click it to fill in some basic personal information, fill it in after filling it in and wait for review
During the review, you need to set the CNAME of the domain name
Attach a NetEase setting interface
After the settings are complete, you need to wait a few hours for review
After the review is passed, it's OK, you can download the certificate
Click to download!
The system will provide settings for different servers and certificates
It should be using NODEJS, but found no, don't worry, just download nginx and it's OK
After downloading and extracting, there are two files
These are the KEY and PEM. Put them in your project, go back to the previous step of the code, and modify a path to OK
Visit with the browser
Display safety! The big job is done!
Declaration: The content of this article is from the network, and the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously. This website does not own the copyright, has not been manually edited, and does not assume any relevant legal liability. If you find any content suspected of copyright infringement, please send an email to notice#w.3Please send an email to codebox.com (replace # with @ when sending an email) to report any violations, and provide relevant evidence. Once verified, this site will immediately delete the infringing content.