我正在尝试将Integrity 持续集成服务器部署到子目录(或基本 URL)。也就是说,我想将它托管在http://dev.example.com/integrity/之类的 URL 上,而不是http://integrity.example.com。
我正在使用独角兽和 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/会显示 Integrity 404(而不是 Nginx 404 页面),因此 Nginx 配置看起来是正确的。但是如何配置 Unicorn/Integrity 以将 /integrity 识别为应用程序根?
将重写规则添加到 Nginx 将不起作用,因为 Integrity 将使用 构造 URL /
,/integrity
因此 CSS、JavaScript 和链接将被破坏。
Integrity 是一个 Sinatra 应用程序,所以也许有一个标准的方法可以做到这一点。