机架 ssl 和 nginx 配置
你好,我正在尝试在我的 nginx 中使用rack ssl。除了我的静态蜻蜓图像(通过 nginx 作为代理)之外,所有页面上的一切都运行良好。这是配置的一部分(ofc 在非 ssl 模式下所有图像都可以正常使用)。知道如何解决这个问题吗?:
server {
listen 0.0.0.0:443;
server_name server.com;
root /home/rails/production/current/public;
passenger_enabled on;
rails_env production;
ssl on;
ssl_certificate some.crt;
ssl_certificate_key some.key;
location /home {
rewrite ^ https://www.example.com/ permanent;
}
location /media {
try_files $uri @media;
}
location @media {
proxy_redirect off;
proxy_pass http://unix:/tmp/nginx-production.sock;
proxy_store /home/rails/production/current/public$uri;
proxy_store_access user:rw group:rw all:r;
}
}
编辑 ------
好吧,我更进一步了。我发现我的 nginx conf 的一部分有这样的内容:
server {
listen unix:/tmp/nginx-production.sock;
root /home/rails/production/current/public;
passenger_enabled on;
rails_env staging;
}
ofc 你看到rails_env 是错误的,所以我将其更改为生产环境,如果没有通过ajax 请求填充,所有图像都会返回正常..所以狩猎继续:(
编辑 -- ---- 也发现了这个。所有不在 ssl 下渲染的图像的 URL 为:https:///media/ chrome 显示 502
,但 redner 的图像显示为: https:///media/?
我开始觉得这与蜻蜓的使用方式有关吗?那为什么有些人可以,而另一些人不行……
Hi I am trying to use rack ssl with my nginx. Everything works fine on all pages apart from my statics dragonfly images which is serve as a proxy via nginx. Here is that part of the config (ofc when in non ssl mode all images serves just fine). Any idea how to solve this?:
server {
listen 0.0.0.0:443;
server_name server.com;
root /home/rails/production/current/public;
passenger_enabled on;
rails_env production;
ssl on;
ssl_certificate some.crt;
ssl_certificate_key some.key;
location /home {
rewrite ^ https://www.example.com/ permanent;
}
location /media {
try_files $uri @media;
}
location @media {
proxy_redirect off;
proxy_pass http://unix:/tmp/nginx-production.sock;
proxy_store /home/rails/production/current/public$uri;
proxy_store_access user:rw group:rw all:r;
}
}
EDIT ------
Ok I got abit further. I found a section of my nginx conf that had this:
server {
listen unix:/tmp/nginx-production.sock;
root /home/rails/production/current/public;
passenger_enabled on;
rails_env staging;
}
ofc you see rails_env was wrong so i changed it to production and all images returns fine if it was not populated via a ajax request.. so the hunt goes on :(
EDIT ------
found this also. All image that does not render under ssl have a URL of: https:///media/ chrome shows a 502
but ones that does redner have:
https:///media/?
Am starting to this is somthing with the way dragonfly is used? Then why is it ok for some and not other...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论