gitlab 安装自带 nginx,如果想利用原有 nginx,可按如下操作:

  • nginx 增加虚拟主机配置

    # gitlab socket 文件地址
    upstream gitlab {server unix://var/opt/gitlab/gitlab-rails/sockets/gitlab.socket;
    }server {listen *:80;server_name gitlab.ces.com;   # 请修改为你的域名server_tokens off;     # don't show the version number, a security best practiceroot /opt/gitlab/embedded/service/gitlab-rails/public;# Increase this if you want to upload large attachments# Or if you want to accept large git objects over httpclient_max_body_size 250m;# individual nginx logs for this gitlab vhostaccess_log  /var/log/gitlab/nginx/gitlab_access.log;error_log   /var/log/gitlab/nginx/gitlab_error.log;location / {# serve static files from defined root folder;.# @gitlab is a named location for the upstream fallback, see belowtry_files $uri $uri/index.html $uri.html @gitlab;}# if a file, which is not found in the root folder is requested,# then the proxy pass the request to the upsteam (gitlab unicorn)location @gitlab {# If you use https make sure you disable gzip compression # to be safe against BREACH attackproxy_read_timeout 300; # Some requests take more than 30 seconds.proxy_connect_timeout 300; # Some requests take more than 30 seconds.proxy_redirect     off;proxy_set_header   X-Forwarded-Proto $scheme;proxy_set_header   Host              $http_host;proxy_set_header   X-Real-IP         $remote_addr;proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;proxy_set_header   X-Frame-Options   SAMEORIGIN;proxy_pass http://gitlab;}# Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression# WARNING: If you are using relative urls do remove the block below# See config/application.rb under "Relative url support" for the list of# other files that need to be changed for relative url supportlocation ~ ^/(assets)/  {root /opt/gitlab/embedded/service/gitlab-rails/public;# gzip_static on; # to serve pre-gzipped versionexpires max;add_header Cache-Control public;}error_page 502 /502.html;
    }
    
  • 禁用自带 nginx

    vim /etc/gitlab/gitlab.rb
    

    加入

    nginx['enable'] = false
    
  • 重启 nginx, 重启gitlab

    sudo /usr/local/nginx/sbin/nginx -s reload
    sudo gitlab-ctl reconfigure
    
  • 权限配置

    访问会报502。原本是 nginx 用户无法访问gitlab用户的 socket 文件,用户权限配置,因人而异。粗暴地:

    sudo chmod -R o+x /var/opt/gitlab/gitlab-rails
    
    1. 拷贝一份内置nginx 的配置文件 gitlab-http.conf 到新的nginx的配置中
    2. 修改 /etc/gitlab/gitlab.rb ,禁用nginx nginx[enable] = false
    3. vim /etc/gitlab/gitlab.rb
    external_url 'http://git.qiwenqiqu.com' #域名配置unicorn['listen'] = '0.0.0.0'unicorn['port'] = 8081
    # git_data_dirs({ "default" => { "path" => "/var/opt/gitlab/git-data" } })git_data_dirs({ "default" => { "path" => "/data/git-data" } })#web_server['external_users'] = ['nginx','gitlab-www','git','www','www-data']
    #新nginx用户www能够访问gitlab,很重要
    web_server['external_users'] = ['www'] #然后 gitlab-ctl reconfigure ,然后 gitlab-ctl restart
    

    备忘录

    1.[端口不通]

    vim /var/opt/gitlab/gitlab-rails/etc/unicorn.rb
    listen “0.0.0.0:8081”, :tcp_nopush => true
    一定不要用 127.0.0.1

    firewall-cmd --permanent --add-port=8081/tcp
    firewall-cmd --reload

    2.[样式错乱] gitlab error compiling css asset

    vim ./embedded/service/gitlab-rails/config/gitlab.yml
    webhook_timeout: 120

    gitlab 数据迁移

    https://andyoung.blog.csdn.net/article/details/120859037

gitlab 使用外部 nginx相关推荐

  1. centos+gitlab+mysql_centos7安装配置gitlab(使用外部nginx)

    1.安装依赖: sudo yum install curl policycoreutils openssh-server openssh-clients sudo systemctl enable s ...

  2. gitlab使用外部nginx反向代理

    1. vim /etc/gitlab/gitlab.rb 编辑nginx['listen_port'] = 8888 此处的8888端口将用于proxy_pass处 2. 编辑外部nginx,在htt ...

  3. gitlab更改默认Nginx

    更换gitlab自带Nginx服务,使用自行编译Nginx来管理gitlab服务. 编辑gitlab配置文件禁用自带Nignx服务器 1 vi /etc/gitlab/gitlab.rb...#设置n ...

  4. gitlab 使用现有 nginx 服务器

    gitlab 安装自带 nginx,如果想利用原有 nginx,可按如下操作: 8.0 版本 socket 文件位置有变动,感谢评论区的同学. nginx 增加虚拟主机配置 # gitlab sock ...

  5. Gitlab+Gerrit+Ldap+nginx+mysql 之Gerrit搭建与配置(一)

    公司之前一直用gitlab来存放项目代码 ,目前因为业务需要(代码bug太多)需要引入gerrit来进行code review. 最初用的是centos 7.4,但是安装完成后,GerritResou ...

  6. Linux 环境安装 Node、nginx、docker、vsftpd、gitlab

    Linux 环境安装 centos7 # 更新yum yum update -y 0. 防火墙 firewalld 新入的JD云服务器,发现防火墙默认是关闭的. # 查看防火墙状态 systemctl ...

  7. nginx反向代理加gitlab认证

    底层直接开辟了docker环境,结合opensumi得到一个持久化的在线编译环境(服务器ip地址+端口号,每个学生用不同的端口号),为了保证每个人的网址都只能自己用,需要在这个网址访问之前加上验证** ...

  8. gitlab配置自带Nginx实现网段访问限制、gitlab配置访问黑白名单、gitlab访问IP限制

    一.在实际应用中,我们个人搭建gitlab环境的时候,都是在公司内网的情况下,只为单独的某个企业/公司使用,所以此时会出现某些特殊的访问需求,比如我只允许公司某个网段中的IP地址访问,或者只允许某几台 ...

  9. nginx代理gitlab

    编辑gitlab配置文件 使用gitlab内置的nginx,修改nginx默认端口,从80变为82.由于这时候进行了上述的配置,因此,修改下列文件会改变默认值.同时,如果重新运行gitlab-ctl ...

最新文章

  1. 把自己分支的内容合并到主分支上
  2. python的with语句
  3. jQuery针对多个元素的相同点击事件
  4. 深入理解 C 指针阅读笔记 -- 第四章
  5. Deno 运行时入门教程:Node.js 的替代品
  6. notepad++是什么?用notepad++来编辑c语言代码
  7. boost::coroutine模块实现parallel的测试程序
  8. java清屏_【图片】请问java编写中如何做到清屏啊。。。_java吧_百度贴吧
  9. 机器学习 vs. 深度学习
  10. linux 短信功能,Android调用系统短信功能发送短信
  11. P3605 [USACO17JAN]Promotion Counting P(树状数组)
  12. Leetcode算法题(C语言)3--买卖股票的最佳时机 II
  13. linux7.0安装过程详解,图解红旗Linux7.0安装过程.doc
  14. new file会创建文件吗_Python处理文件—os模块
  15. 内联函数和宏定义的相关区别
  16. Linux 环境下安装 MySQL,各种踩坑、疑难杂症 | 原力计划
  17. live2d_vue-live2d 看板娘
  18. [转载] Python 快速入门实战教程
  19. pytorch固定BN层参数
  20. 怎么增加C盘空间大小,教你如何调整C盘容量【图文教程 无损数据】分区助手如何给磁盘分区 分区助手使用方法教程

热门文章

  1. MyBatis 一对多嵌套查询
  2. JS 日期 - JS 比较
  3. Java emf转png
  4. Android播放照相机声音
  5. RestTemplate 设置超时时间
  6. 小菜鸡近期的一些胡思乱想
  7. Git 首次关联远程仓库(代码有冲突解决)
  8. html全局页边距代码,在非常宽的HTML表格上获得正确的页边距?
  9. 漫谈程序员:怎样成为技术达人
  10. 聚宽 get_price 多个股票数据_聚宽量化一个命令获取全部股票全部的财务报表数据...