禁止gitlab自带的Nginx使用服务器独立的Nginx配置

安装后本机的nginx就没办法启动了

Nginx 无法启动原因
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8081 failed (98: Address already in use)

两个Nginx 冲突了,遇到了很多难题。端口绑定问题

一、修改gitlab配置,禁止自带nginx

路径 vi /etc/gitlab/gitlab.rb

nginx['enable'] = false      禁用自带nginx
gitlab_workhorse['listen_network'] = "tcp"      允许gitlab-workhorse监听TCP
gitlab_workhorse['listen_addr'] = "127.0.0.1:8091"  设置gitlab端口为8091 注意自己的 8091未占用
external_url 'http://git.xxx.com:80'       设置git访问: 域名:nginx端口  此处80为独立nginx端口
gitlab_rails['trusted_proxies'] = ['git.xxx.com']      设置gitlab域名

二、配置服务器自身的nginx

Nginx 配置
git.java-er.com.conf

 server {
        listen       80;
        server_name  git.yj09.com;
        client_max_body_size 200m;
 
        location / {
                index index.html index.htm index.php;
                root html;
                proxy_pass http://127.0.0.1:8091;
       }
        error_page 404 /404.html;
            location = /40x.html {
        }
 
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }


This entry was posted in Linux and tagged , . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/forbidden-gitlab-nginx/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.
2020.03.24 评论已经全局关闭,有事加QQ聊天