2013-03-19 56 views
2

我正在尝试将Integrity continuous integration server部署到子目录(或基本URL)。也就是说,我想通过网址http://dev.example.com/integrity/而不是http://integrity.example.com来托管它。将完整性CI部署到Nginx和Unicorn上的子目录

我正在使用Unicorn和Nginx。我的Nginx的配置:

upstream integrity { 
    server unix:/home/integrity_ci/integrity/tmp/sockets/integrity.socket; 
} 

server { 
    server_name dev.example.com; 
    location /integrity { 
     proxy_pass http://integrity; 
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
     proxy_set_header Host $http_host; 
     proxy_redirect off; 
    } 
} 

http://dev.example.com/integrity/带来了诚信404(而不是Nginx的404页),所以Nginx的配置看起来是正确的。但是,如何将Unicorn/Integrity配置为应用程序根识别/完整性?

添加重写规则的Nginx是行不通的,因为诚信将建立网址/宁可/integrity,所以CSS,JavaScript和链接将被打破。

完整性是一个Sinatra应用程序,所以也许有一个标准的方法来做到这一点。

+0

它看起来像基本的URL来自'request.script_name'。请参阅使用fastCGI设置此方法,但如何使用Unicorn进行设置? – Jimothy 2013-03-19 12:51:21

回答

2

config.ru,替换:

run Integrity.app 

有:

map ('/integrity') { run Integrity.app }