【发布时间】:2014-02-02 20:43:12
【问题描述】:
我已经设置了我的 rails 应用程序,效果很好。不幸的是,在该网站的 https:// 版本上,我的任何资产都没有得到服务……知道为什么会发生这种情况吗?所有资产都通过 http:// 提供,但没有通过 https://
帮助?
============= 代码==============
upstream unicorn {
server unix:/tmp/unicorn.XXX.sock fail_timeout=0;
}
server {
listen 80 default;
server_name example.com;
root /home/deployer/apps/XXX/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-Proto http;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 5G;
keepalive_timeout 10;
send_timeout 240;
sendfile_max_chunk 5m;
}
server {
listen 443;
server_name example.com;
root /home/webuser/apps/XXX/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri @non-ssl-redirect @unicorn;
location @unicorn {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 5G;
keepalive_timeout 10;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:-ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP;
ssl_session_cache shared:SSL:10m;
send_timeout 240;
sendfile_max_chunk 5m;
}
【问题讨论】:
标签: ruby-on-rails ssl nginx https asset-pipeline