nginx - 将 Integrity CI 部署到 Nginx 和 Unicorn 上的子目录

标签 nginx sinatra unicorn

我正在尝试部署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/

相关文章:

json - nginx 不缓存 json,而是缓存 .jpg 文件

ruby - 是什么让浓缩咖啡如此之快?

ruby - 西纳特拉:三个日志

ruby-on-rails - 如果我不在 after_fork 中 $redis = Redis.new 会发生什么?

python - 将 Django 应用程序映射到 Docker 容器,使用 URL 寻址

ruby-on-rails - 如何在 Firefox 中显示 Font Awesome 图标?

ruby-on-rails - Heroku、Unicorn 和延迟作业上的 Rails:PG::ConnectionBadappmodels/post.rb:93 PQconsumeInput() SSL SYSCALL 错误:连接超时

ruby-on-rails - Ubuntu: 'unicorn_init.sh start' 有效,但 'service unicorn_init start' 无效

java - PlayFramework 在 http 而不是 httpS 中返回绝对 url?

postgresql - Docker构建无法在Sinatra项目中安装pg gem