gpt4 book ai didi

nginx - 如何在 Gitlab Omnibus 服务器旁边为其他虚拟主机提供服务? [完整的逐步解决方案]

转载 作者:行者123 更新时间:2023-12-02 11:04:29 26 4
gpt4 key购买 nike

我安装了 Gitlab CE 在带有 的专用 Ubuntu 14.04 服务器版本上综合包 .

现在我想安装另外三个 虚拟主机 在 gitlab 旁边。

两个是由 non-root user 启动的 node.js Web 应用程序。在两个不同的 ports > 1024 上运行,第三个是需要从 Web 服务器启动的 PHP Web 应用程序。

有:

  • 8081 上运行的私有(private)凉亭注册表( node.js )
  • 8082 上运行的私有(private) npm 注册表( node.js )
  • 私有(private) Composer 注册表(PHP)

  • 但是 综合听80 并且似乎既不使用 Apache2 也不使用 Nginx, 因此我不能使用它们来服务我的 PHP 应用程序并反向代理我的其他两个节点应用程序 .

    What serving mechanics Gitlab Omnibus uses to listen 80 ? How should I create the three other virtual hosts to be able to provide the following vHosts ?

    • gitlab.mycompany.com (:80) -- already in use
    • bower.mycompany.com (:80)
    • npm.mycompany.com (:80)
    • packagist.mycompany.com (:80)

    最佳答案

    由于我不想为 gitlab 更改 nginx 服务器(与其他一些集成),所以最安全的方法是下面的解决方案。

    也按照

    Gitlab:Ningx =>Inserting custom settings into the NGINX config

    编辑你的 gitlab 的/etc/gitlab/gitlab.rb :

    nano /etc/gitlab/gitlab.rb

    并滚动到 nginx['custom_nginx_config'] 并进行如下修改,确保取消注释
    # Example: include a directory to scan for additional config files
    nginx['custom_nginx_config'] = "include /etc/nginx/conf.d/*.conf;"

    创建新的配置目录:
    mkdir -p /etc/nginx/conf.d/
    nano /etc/nginx/conf.d/new_app.conf

    并将内容添加到您的新配置中
    # my new app config : /etc/nginx/conf.d/new_app.conf
    # set location of new app
    upstream new_app {
    server localhost:1234; # wherever it might be
    }
    # set the new app server
    server {
    listen *:80;
    server_name new_app.mycompany.com;
    server_tokens off;
    access_log /var/log/new_app_access.log;
    error_log /var/log/new_app_error.log;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    location / { proxy_pass http://new_app; }
    }

    并重新配置 gitlab 以插入新设置
    gitlab-ctl reconfigure

    重启 nginx
    gitlab-ctl restart nginx

    检查 nginx 错误日志:
    tail -f /var/log/gitlab/nginx/error.log

    关于nginx - 如何在 Gitlab Omnibus 服务器旁边为其他虚拟主机提供服务? [完整的逐步解决方案],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31762841/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com