2011-12-14 39 views
0

我有rails應用程序與有用的nginx和乘客運行,並且我想添加靜態頁面(調用代碼覆蓋率分析工具 - simplecov)。 Localy這工作正常(沒有乘客),但在服務器上這不起作用。 我的nginx.conf:nginx與乘客不處理靜態資產

#user nobody; 
worker_processes 1; 


events { 
    worker_connections 1024; 
    #speed up for linux 2.6+ 
    use epoll; 
} 


http { 

    passenger_root /home/demo/.rvm/gems/[email protected]/gems/passenger-3.0.9; 
    passenger_ruby /home/demo/.rvm/wrappers/[email protected]/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; 
     }}} 

而且沒有收到,當我嘗試打至coverage.mysite.com:4444。

回答

2

我想我記得在我的一個rails應用程序中碰到過類似的東西。

您是否嘗試過評論,並通過16

取消註釋下面?:

# 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' 

它應該是接近頂部的線條,圍繞第12行試一下,然後redploy和測試在瀏覽器中。