<p>GitLab omnibus and self-managed installs ship with NGINX which is exposed and documented here,</p>
<ul>
<li><a href="https://docs.gitlab.com/omnibus/settings/nginx.html#inserting-custom-nginx-settings-into-the-gitlab-server-block" rel="nofollow noreferrer">https://docs.gitlab.com/omnibus/settings/nginx.html#inserting-custom-nginx-settings-into-the-gitlab-server-block</a></li>
</ul>
<p>You basically edit the <code>gitlab.rb</code> file, edit <code>nginx['custom_gitlab_server_config']</code> and then rerun <code>gitlab-ctl reconfigure</code> to regenerate the nginx confs and restart nginx.</p>

CC BY-SA 4.0
2022-06-07T21:42:24.247Z
2022-06-07T21:42:24.247Z
Evan Carroll
<p>Our old BitBucket server had a URL like this,</p>
<ul>
<li><a href="https://bitbucket.acme.net/scm/acmegroup/acme-project.git" rel="nofollow noreferrer">https://bitbucket.acme.net/scm/acmegroup/acme-project.git</a></li>
</ul>
<p>And, we're wanting to move to GitLab with a DNS switch which has a different URL-convention namely</p>
<ul>
<li><a href="https://gitlab.acme.net/acmegroup/acme-project.git" rel="nofollow noreferrer">https://gitlab.acme.net/acmegroup/acme-project.git</a></li>
</ul>
<p>The <code>/scm/</code> is what I'd like to fix. Is there a way to rewrite URLs through configuration of the GitLab server such that I can make</p>
<ul>
<li><a href="https://gitlab.acme.net/scm/acmegroup/acme-project.git" rel="nofollow noreferrer">https://gitlab.acme.net/scm/acmegroup/acme-project.git</a></li>
</ul>
<p>Redirect to</p>
<ul>
<li><a href="https://gitlab.acme.net/acmegroup/acme-project.git" rel="nofollow noreferrer">https://gitlab.acme.net/acmegroup/acme-project.git</a></li>
</ul>
<p>Note, I know I can change the &quot;Custom Git clone URL for HTTP(S)&quot; and <em>&quot;Replaces the clone URL root&quot;</em> under GitLab's <code>admin/application_settings/general</code>.</p>

<gitlab><dns><url>
Server-side Gitlab URL rewriting?
Evan Carroll
# Server-side Gitlab URL rewriting?

(Asked by: username_0 on 2022-06-07)

Our old BitBucket server had a URL like this,

* <https://bitbucket.acme.net/scm/acmegroup/acme-project.git>

And, we're wanting to move to GitLab with a DNS switch which has a different URL-convention namely

* <https://gitlab.acme.net/acmegroup/acme-project.git>

The `/scm/` is what I'd like to fix. Is there a way to rewrite URLs through configuration of the GitLab server such that I can make

* <https://gitlab.acme.net/scm/acmegroup/acme-project.git>

Redirect to

* <https://gitlab.acme.net/acmegroup/acme-project.git>

Note, I know I can change the "Custom Git clone URL for HTTP(S)" and *"Replaces the clone URL root"* under GitLab's `admin/application_settings/general`.

**Tags:** gitlab, dns, url


---

## 1 answers

### Answer by username_0 on 2022-06-07. Score: 0 | Accepted answer

GitLab omnibus and self-managed installs ship with NGINX which is exposed and documented here,

* <https://docs.gitlab.com/omnibus/settings/nginx.html#inserting-custom-nginx-settings-into-the-gitlab-server-block>

You basically edit the `gitlab.rb` file, edit `nginx['custom_gitlab_server_config']` and then rerun `gitlab-ctl reconfigure` to regenerate the nginx confs and restart nginx.


---

