我設置了我的導軌應用程序,效果很好。不幸的是,在該網站的https://版本中,我的資產沒有被投放......對於這種情況發生的原因有任何想法?所有資產都通過http://提供服務,但無一通過https://使用NGINX和Unicorn在Rails 3應用程序中使用資產VIA SSL
幫助?
============= CODE ==============
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;
}
這適用於像我的application.css文件以及? –
我在上面添加了我的nginx.conf文件(有一些遺漏)。 –