请找到解决此问题的正确方法。
当您仅使用 yourdomain.crt 文件时,private_pub 在与 rails 服务器握手时将无法工作。
因此,您的 SSL 证书提供商将为您提供 middle.crt 或 CAbundle 文件。
只要你有 CA 提供的 ca-bundle 文件
*cat yourdomain.crt whatever.ca-bundle > yourdomainfinal.crt*
如果你有中级证书
*cat yourdomain.crt intermediate.crt > yourdomainfinal.crt*
然后在运行服务器时使用 yourdomainfinal.crt 和您的私钥 yourdomain.key 指向 ssl 验证。
请找到瘦服务器的块
---
chdir: "/home/your/project/path"
environment: "your environment"
timeout: 30
log: "/home/your/project/path/log/thin.log"
pid: /home/your/project/path/tmp/pids/thin.pid
max_conns: 1024
require: []
max_persistent_conns: 1000
wait: 30
threadpool_size: 20
servers: 1
threaded: true
socket: /tmp/thin.sock
ssl: true
ssl_key_file: /home/your/project/path/ssl/yourdomain.key
ssl_cert_file: /home/your/project/path/ssl/yourdomainfinal.crt
对于私人酒吧
要在 ssl 上使用私有 pub,请在 private_pub_thin.yml 中使用以下配置
---
port: 4443
ssl: true
ssl_key_file: /path/to/yourdomain.key
ssl_cert_file: /path/to/yourdomainfinal.crt
environment: "your environment"
rackup: private_pub.ru
然后使用以下命令运行服务器
*thin -C config/private_pub_thin.yml start*
如果您正在使用捆绑器,请不要忘记使用
*RAILS_ENV="your environment" bundle exec thin -C config/private_pub_thin.yml start*
当你使用 bundler 时,上面的命令很重要,如果你不这样做,那么你的私人 pub 将启动并且在运行服务器时没有问题,但它不会发布消息。这就是我观察到的。
请注意,请检查天气,您的服务器的防火墙设置中允许端口 4443 使用**sudo ufw status**
而已!!!如果您按照上述所有指定步骤操作,您应该让 private_pub 用于生产或通过 SSL 进行 uat。