2013-03-19 28 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 }