Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何配置ssl #3034

Closed
seagullz4 opened this issue Oct 16, 2023 · 9 comments
Closed

如何配置ssl #3034

seagullz4 opened this issue Oct 16, 2023 · 9 comments

Comments

@seagullz4
Copy link

如何配置ssl证书

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: How to configure ssl

How to configure ssl certificate

@Yidadaa
Copy link
Collaborator

Yidadaa commented Oct 16, 2023

自行搜索 ngnix 教程。

@Yidadaa Yidadaa closed this as completed Oct 16, 2023
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Search for ngnix tutorials yourself.

@syncmeta
Copy link

这里用的是Node.js,如果你是用docker创建的,可以通过修改容器内的/app/server.js来配置ssl
在文件中添加以下内容:
const https = require('https');
const fs = require('fs');
const options = {
key: fs.readFileSync('私钥的目录'),
cert: fs.readFileSync('证书的目录')
};
然后修改这一行:
原来是这样:const server = http.createServer(async (req, res) => {
修改成:const server = https.createServer(options, async (req, res) => {
修改完之后重启容器就好

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Node.js is used here. If you created it with docker, you can configure ssl by modifying /app/server.js in the container.
Add the following content to the file:
const https = require('https');
const fs = require('fs');
const options = {
key: fs.readFileSync('Private key directory'),
cert: fs.readFileSync('Certificate directory')
};
Then modify this line:
It turns out to be this: const server = http.createServer(async (req, res) => {
Modify to: const server = https.createServer(options, async (req, res) => {
After modification, just restart the container.

@Tasselmi
Copy link

Tasselmi commented Sep 3, 2024

看我的教程,老哥哥们: 免费自动续期签发的证书服务手把手教您

记得在底部评论给个好评额。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Watch my tutorial, brothers: [Teach you step-by-step on the free automatic renewal certificate service](https://scalapie.com/2024/08/31/%E4%BB%8E%E9%9B%B6% E5%BC%80%E5%A7%8B%E9%83%A8%E7%BD%B2%E4%B8%AA%E4%BA%BA%E7%BD%91%E7%AB%99%E4% B8%8A%E7%BA%BF%E4%B9%8B7/)

**Remember to leave a favorable comment in the bottom comment. **

@Tasselmi
Copy link

Tasselmi commented Sep 3, 2024

@seagullz4

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


@seagullz4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants