gitlab 使用外部 nginx
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
- 拷贝一份内置nginx 的配置文件 gitlab-http.conf 到新的nginx的配置中
- 修改 /etc/gitlab/gitlab.rb ,禁用nginx nginx[enable] = false
- 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.[端口不通]
firewall-cmd --permanent --add-port=8081/tcp
firewall-cmd --reload2.[样式错乱] gitlab error compiling css asset
vim ./embedded/service/gitlab-rails/config/gitlab.yml
webhook_timeout: 120gitlab 数据迁移
gitlab 使用外部 nginx相关推荐
- centos+gitlab+mysql_centos7安装配置gitlab(使用外部nginx)
1.安装依赖: sudo yum install curl policycoreutils openssh-server openssh-clients sudo systemctl enable s ...
- gitlab使用外部nginx反向代理
1. vim /etc/gitlab/gitlab.rb 编辑nginx['listen_port'] = 8888 此处的8888端口将用于proxy_pass处 2. 编辑外部nginx,在htt ...
- gitlab更改默认Nginx
更换gitlab自带Nginx服务,使用自行编译Nginx来管理gitlab服务. 编辑gitlab配置文件禁用自带Nignx服务器 1 vi /etc/gitlab/gitlab.rb...#设置n ...
- gitlab 使用现有 nginx 服务器
gitlab 安装自带 nginx,如果想利用原有 nginx,可按如下操作: 8.0 版本 socket 文件位置有变动,感谢评论区的同学. nginx 增加虚拟主机配置 # gitlab sock ...
- Gitlab+Gerrit+Ldap+nginx+mysql 之Gerrit搭建与配置(一)
公司之前一直用gitlab来存放项目代码 ,目前因为业务需要(代码bug太多)需要引入gerrit来进行code review. 最初用的是centos 7.4,但是安装完成后,GerritResou ...
- Linux 环境安装 Node、nginx、docker、vsftpd、gitlab
Linux 环境安装 centos7 # 更新yum yum update -y 0. 防火墙 firewalld 新入的JD云服务器,发现防火墙默认是关闭的. # 查看防火墙状态 systemctl ...
- nginx反向代理加gitlab认证
底层直接开辟了docker环境,结合opensumi得到一个持久化的在线编译环境(服务器ip地址+端口号,每个学生用不同的端口号),为了保证每个人的网址都只能自己用,需要在这个网址访问之前加上验证** ...
- gitlab配置自带Nginx实现网段访问限制、gitlab配置访问黑白名单、gitlab访问IP限制
一.在实际应用中,我们个人搭建gitlab环境的时候,都是在公司内网的情况下,只为单独的某个企业/公司使用,所以此时会出现某些特殊的访问需求,比如我只允许公司某个网段中的IP地址访问,或者只允许某几台 ...
- nginx代理gitlab
编辑gitlab配置文件 使用gitlab内置的nginx,修改nginx默认端口,从80变为82.由于这时候进行了上述的配置,因此,修改下列文件会改变默认值.同时,如果重新运行gitlab-ctl ...
最新文章
- 把自己分支的内容合并到主分支上
- python的with语句
- jQuery针对多个元素的相同点击事件
- 深入理解 C 指针阅读笔记 -- 第四章
- Deno 运行时入门教程:Node.js 的替代品
- notepad++是什么?用notepad++来编辑c语言代码
- boost::coroutine模块实现parallel的测试程序
- java清屏_【图片】请问java编写中如何做到清屏啊。。。_java吧_百度贴吧
- 机器学习 vs. 深度学习
- linux 短信功能,Android调用系统短信功能发送短信
- P3605 [USACO17JAN]Promotion Counting P(树状数组)
- Leetcode算法题(C语言)3--买卖股票的最佳时机 II
- linux7.0安装过程详解,图解红旗Linux7.0安装过程.doc
- new file会创建文件吗_Python处理文件—os模块
- 内联函数和宏定义的相关区别
- Linux 环境下安装 MySQL,各种踩坑、疑难杂症 | 原力计划
- live2d_vue-live2d 看板娘
- [转载] Python 快速入门实战教程
- pytorch固定BN层参数
- 怎么增加C盘空间大小,教你如何调整C盘容量【图文教程 无损数据】分区助手如何给磁盘分区 分区助手使用方法教程