You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地部署带域名的GitLab如何修改默认端口实现无端口登录

解决GitLab需带端口访问的问题
  • 不要直接修改/var/opt/gitlab/nginx/conf/gitlab-http.conf,执行gitlab-ctl reconfigure时会覆盖该文件的自定义修改,所有Nginx相关配置需通过/etc/gitlab/gitlab.rb管理。

  • 修改/etc/gitlab/gitlab.rb中的关键配置:

    1. 设置不含端口的外部访问地址:
      external_url 'https://your-domain.com' # 若未配置HTTPS,改用http://your-domain.com
      
    2. 配置Nginx监听标准端口:
      nginx['listen_port'] = 80 # HTTP协议用80端口
      # 若启用HTTPS,替换为以下配置并补充证书路径:
      # nginx['listen_port'] = 443
      # nginx['ssl_certificate'] = "/path/to/your/ssl.crt"
      # nginx['ssl_certificate_key'] = "/path/to/your/ssl.key"
      
    3. 检查并移除文件中所有强制指定非标准端口的配置项。
  • 保存配置后执行命令生效:

    gitlab-ctl reconfigure
    gitlab-ctl restart nginx
    
  • 验证:直接访问你的域名(如https://your-domain.com),确认无需加端口即可正常登录GitLab。

内容的提问来源于stack exchange,提问作者Abhilash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 14:57:28