Question

How to proxy Gitlab nginx into Apache2?

So I have a few sites on my droplet already going through apache. I installed gitlab, and it just took over everything because nginx runs over everything. I was silly enough to install the omnibus package (https://www.gitlab.com/downloads/) not realizing that it was a very unordinary install.

I have googled for days and came up with nothing, because apparently no one uses this type install! Basically, I want to have gitlab.mydomain.com go to the gitlab and everything else proxy to apache. I’m not entirely sure what information to include here (my configs etc), because I’m pretty much lost now, so please ask, and I will provide more information.

So far I’ve tried so many different variations that I’m not even sure where I’m at anymore. This is driving me mad. Any information would be fantastic!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It’s all slightly more complicated as the package provided by GitLab bundles a lot of things in /opt. They assume it will be the only thing running on the server, but it is still doable. <br> <br>In “/var/opt/gitlab/nginx/etc/gitlab-http.conf” set the server name to gitlab.mydomain.com: <br> <br><pre> <br>server { <br> listen *:80; <br> server_name gitlab.mydomain.com; <br> server_tokens off; # don’t show the version number, a security best practice <br> root /opt/gitlab/embedded/service/gitlab-rails/public; <br></pre> <br> <br>Then create a new server block that will forward other connections onto Apache: <br> <br><pre> <br>server { <br> listen 80; <br> <br> root /var/www/; <br> index index.php index.html index.htm; <br> <br> server_name mydomain.com; <br> <br> location / { <br> try_files $uri $uri/ /index.php; <br> } <br> <br> location ~ .php$ { <br>
<br> proxy_set_header X-Real-IP $remote_addr; <br> proxy_set_header X-Forwarded-For $remote_addr; <br> proxy_set_header Host $host; <br> proxy_pass http://127.0.0.1:8080; <br> <br> } <br> <br> location ~ /.ht { <br> deny all; <br> } <br>} <br></pre> <br> <br>Then in your Apache configuration, change the VirtualHost to listen on port 8080: <br> <br><pre> <br><VirtualHost 127.0.0.1:8080> <br></pre> <br> <br>This article about using Nginx as a proxy for Apache should be helpful: <br> <br>https://digitalocean.com/community/articles/how-to-configure-nginx-as-a-front-end-proxy-for-apache <br> <br>There’s also an article about installing GitLab from source. That might be a better option for you: <br> <br>https://digitalocean.com/community/articles/how-to-set-up-gitlab-as-your-very-own-private-github-clone <br> <br>Let us know how it goes!