我需要为我的网站设置HTTPS(Nginx,Rails 4)。我使用了this post的说明。
我做了所有事情直到它说“配置你的Nginx服务器以使用新密钥和证书”。
问题是我不确切知道nginx.conf文件应该是什么样子。我找到了something that says how to set it up for Rails,我试过了,但没有重启。这是我添加到我的文件中(它没有用):
server {
listen 443;
ssl on;
# path to your certificate
ssl_certificate /etc/nginx/ssl/mysite.com.unified.crt;
# path to your ssl key
ssl_certificate_key /etc/nginx/ssl.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # don’t use SSLv3 ref: POODLE
# put the rest of your server configuration here.
#location / {
# set X-FORWARDED_PROTO so ssl_requirement plugin works
proxy_set_header X-FORWARDED_PROTO https;
# standard rails+mongrel configuration goes here.
}
}