search

Home  >  Q&A  >  body text

centos - Omnibus-GitLab 部署 如何使用已经安装的nginx

按照官方文档已经成功部署
但是 想使用原来已经安装好的nginx,来代理使用
google查询了很多教程,没用成功。

PHPzPHPz2804 days ago648

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-04-25 09:04:29

    This thing is so troublesome. When I was doing this, I was tortured to death. Its nginx would often grab the 80 monitoring of the original nginx of the system.

    Although the official claim is that just disabling nginx in the configuration file will do the trick, errors often occur when I operate it. So:

    My solution:

    Edit the gitlab configuration file: /etc/gitlab/gitlab.rb Add the following configuration:

    # disable gitlab's nginx
    nginx['enable'] = false
    
    # For GitLab CI, use the following:
    ci_nginx['enable'] = false

    Replace /opt/gitlab/embedded/conf/nginx.conf 里 gitlab 默认的监听 80 改成 88, and then add the following in the main nginx configuration:

    upstream gitlab {
        server 127.0.0.1:88;
        server 127.0.0.1:88;
    }
    
    server {
        listen 80;
        server_name mygit.mydomain.com;
        access_log  /data/log/nginx/gitlab.access.log;
        error_log /data/log/nginx/gitlab.error.log;
    
        large_client_header_buffers 4 16k;
        client_max_body_size 300m;
        client_body_buffer_size 128k;
        proxy_connect_timeout 300;
        proxy_read_timeout 300;
        proxy_send_timeout 300;
        proxy_buffer_size 64k;
        proxy_buffers   4 32k;
        proxy_busy_buffers_size 64k;
        proxy_temp_file_write_size 64k;
    
        location / {
            proxy_pass http://gitlab;
            proxy_redirect off;
            proxy_set_header Host $host;
            proxy_set_header Host $proxy_host;
            proxy_set_header X-Real_IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

    Reload gitlab configuration and reload main nginx.

    sudo gitlab-ctl reconfigure
    sudo nginx -s reload

    reply
    0
  • Cancelreply