Replies: 7 comments
-
1 最简单的是 你用 railway或者fly.io 这样的平台 他们有绑定自己域名的教程 应该很简单 大致思路如此 你搜搜看
这个功能倒是不难做 主要有代替方案 我本人时间有限 如果你懂基本数据库 直接db里面删除就行了 用一个db 管理软件 也有图形界面 |
Beta Was this translation helpful? Give feedback.
-
Sure, I'd be happy to help! From what I understand, you're looking for a way to configure HTTPS for a Docker container running on port 8080 using an existing certificate. Additionally, you're looking to run Nginx in another Docker container as a reverse proxy to serve HTTPS traffic for a container named "chat" that exposes port 8080. Here's how you can go about it:
Here, we are creating two server blocks – one for HTTP and one for HTTPS. We're also specifying the SSL certificate and key locations, as well as the proxy_pass configuration to forward requests to our "chat" container on port 8080.
In this example Dockerfile, we're copying the Nginx configuration file, SSL certificate, and SSL key from our Docker host to our Nginx container. Additionally, we're exposing ports 80 and 443.
Here, we're running both containers in detached mode. We're also linking our Nginx container to our "chat" container using the --link flag. That's it! Your Docker containers should now be accessible via HTTPS using your SSL certificate. |
Beta Was this translation helpful? Give feedback.
-
Certainly! Here's a Docker Compose file that should work for the setup described in my previous answer:
Here, we're defining two services – one for the "chat" container and one for the Nginx reverse proxy container. Note that we're linking our Nginx container to our "chat" container using the links attribute. We're also defining the ports that our services will use. The "chat" container is using port 8080, while the Nginx container is using ports 80 and 443. When you run |
Beta Was this translation helpful? Give feedback.
-
看起来是对的 另外 你需要把db 配置好 你如果试了 可以把过程记录下来 方便后人 |
Beta Was this translation helpful? Give feedback.
-
https://swuecho-chat-m.fly.dev/static/#/snapshot/c83222f5-ef38-4490-8816-99c5f92f8c28 原始对话记录 |
Beta Was this translation helpful? Give feedback.
-
更简单的 Sure, here's how we can create a Golang HTTPS server at port 443: package main
import (
"log"
"net/http"
)
func main() {
// Set the server parameters
addr := ":443"
certFile := "/path/to/cert_file"
keyFile := "/path/to/key_file"
// Create a new HTTPS server with the given parameters
server := &http.Server{
Addr: addr,
Handler: nil,
}
// Start the server
log.Fatal(server.ListenAndServeTLS(certFile, keyFile))
} In this code, we create a new HTTPS server using the We then start the server using the |
Beta Was this translation helpful? Give feedback.
-
https://github.com/swuecho/chat/pull/209/files 你参考这个branch, 自己build docker 就好了. 因为增添了一些参数, 这个不merge. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
开发者你好.
我搜了一下issues, 好像没有关于如何配置 https 的提问, README也没提到.
如果我已经有证书了, 怎么可以配置一下?
Beta Was this translation helpful? Give feedback.
All reactions