我正在尝试部署Integrity continuous integration server到子目录(或基本 URL)。也就是说,我想将其托管在类似 http://dev.example.com/integrity/ 的 URL 上。而不是http://integrity.example.com .
我正在使用 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/显示 Integrity 404(而不是 Nginx 404 页面),因此 Nginx 配置看起来是正确的。但是如何配置 Unicorn/Integrity 以将/integrity 识别为应用程序根目录?
向 Nginx 添加重写规则不起作用,因为 Integrity 将使用 /
而不是 /integrity
构造 URL,因此 CSS、JavaScript 和链接将被破坏.
Integrity 是一个 Sinatra 应用程序,因此也许有一种标准方法可以做到这一点。
最佳答案
在config.ru
中,替换:
run Integrity.app
与:
map ('/integrity') { run Integrity.app }
关于nginx - 将 Integrity CI 部署到 Nginx 和 Unicorn 上的子目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15499721/