gpt4 book ai didi

ruby-on-rails - 如何使用 nginx 配置 phusion passenger 以支持 rails 中的 ssl?

转载 作者:太空宇宙 更新时间:2023-11-03 13:38:04 26 4
gpt4 key购买 nike

我按照 DigitalOcean 上的说明操作:https://www.digitalocean.com/community/tutorials/how-to-create-an-ssl-certificate-on-nginx-for-ubuntu-14-04

这是我的 nginx.conf 文件...似乎不起作用。

events {
worker_connections 1024;
}

http {

ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
keepalive_timeout 70;

server {
listen 80;
listen 443;
ssl on;

server_name localhost;

ssl_certificate /Users/sambit/Documents/Projects/SBOOKS/nginx.crt;
ssl_certificate_key /Users/sambit/Documents/Projects/SBOOKS/nginx.key;

# Extra protections
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/font-woff2 application/x-javascript text/css application/javascript text/javascript text/xml application/json application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf application/xml font/eot font/opentype font/otf image/svg+xml;

# Tell Nginx and Passenger where your app's 'public' directory is
root /Users/sambit/Documents/Projects/SBOOKS/public;

location ~ ^/(assets|images|javascripts|stylesheets|swfs|system)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
}

# Turn on Passenger
passenger_enabled on;
passenger_ruby /Users/sambit/.rvm/rubies/ruby-2.2.2/bin/ruby;
}
}

我正在尝试在 Mac 上测试它.. (el capitan)

我在 chrome 中得到的错误是 (ERR_SSL_PROTOCOL_ERROR)

  • 我还在 7200 端口上与 foreman 一起运行我的 Rails 应用

foreman start -p 7200

我的临时解决方案是使用 passenger 来处理 http 请求,并在同一台机器上生成 puma 来处理 https 请求(均通过工头)。我知道这很老套,所以我正在寻找更好的基于乘客的解决方案。

最佳答案

乘客作者在这里。您还必须设置 ssl on

关于ruby-on-rails - 如何使用 nginx 配置 phusion passenger 以支持 rails 中的 ssl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33486306/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com