[英]nginx with passenger don't handle static assets
I have rails app running with helpfull nginx and passenger, and I want to add static page (conteins code coverage analysis tool - simplecov). 我有rails app运行有用的nginx和乘客,我想添加静态页面(conteins代码覆盖率分析工具 - simplecov)。 Localy this works fine (without passenger), but on the server this don't works.
Localy这个工作正常(没有乘客),但在服务器上这不起作用。 My nginx.conf:
我的nginx.conf:
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
#speed up for linux 2.6+
use epoll;
}
http {
passenger_root /home/demo/.rvm/gems/ruby-1.9.3-p0@gm/gems/passenger-3.0.9;
passenger_ruby /home/demo/.rvm/wrappers/ruby-1.9.3-p0@gm/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name *.dev.mysite.com;
root /var/www/projects/mysite/qa/current/public;
passenger_enabled on;
rails_env qa;
charset utf-8;
error_log /var/www/projects/mysite/qa/shared/log/host.error.log;
}
#Coverage code tool (SimpleCov gem)
server {
listen 4444;
server_name coverage.mysite.com;
location / {
root /var/lib/jenkins/jobs/WebForms/workspace/coverage;
index index.html index.htm;
}
}
#Yard server
server {
listen 5555;
server_name yard.mysite.com;
location / {
proxy_pass http://127.0.0.1:8808;
}}}
And nothing receive when I try to hit to coverage.mysite.com:4444. 当我试图触及coverage.mysite.com:4444时,什么都没收到。
I think I remember coming across something similar to this on one of my rails apps. 我想我记得在我的一个rails应用程序中遇到类似的东西。
Have you tried commenting and uncommenting the lines below?: 您是否尝试过评论并取消注释下面的行?:
# in config/environments/production.rb
# Specifies the header that your server uses for sending files
#config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
It should be near the top, around line 12 through 16. 它应该靠近顶部,在12到16号线附近。
Try that, then redploy and test in the browser. 试试,然后在浏览器中重新部署和测试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.