Configuring nginx to serve multiples subdomains on Gitlab dropplet

June 15, 2014 10k views
Hello, I have set up a Gitlab dropplet which is working fine. I would like to leave gitlab on a specific subdomain and use nginx to server other websites too. I already edited gitlab to answer on that subdomain ( but I don't know how to configure nginx to point the other ones. I could not find the standard sites-availables, sites-enabled folders. Can you help me?
3 Answers
Hi Leto, I'll do my best to help you but first I just need to know some more information. Why are you unable to use the standard sites-available/sites-enabled(sites-enabled is just system links to sites available btw) You can setup a server block like this in whatever configuration file you are using to allow another domain
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    server_name localhost;

    location / {
        try_files $uri $uri/ =404;
Hope this helps...
  • Hi David, Thanks for your help. The standard sites-available just doesn't exist on the server. Apparently, nginx config is on /var/opt/gitlab/nginx/etc/nginx.conf and /var/opt/gitlab/nginx/etc/gitlab-http.conf These files has a header which says: # This file is managed by gitlab-ctl. Manual changes will be # erased! To change the contents below, edit /etc/gitlab/gitlab.rb # and run `sudo gitlab-ctl reconfigure`. I'm not sure how and where I should edit the files. Nginx is not even an installed service...
The GitLab one-click image uses GitLab's "omnibus" installer. It's designed to run in a self contained manner and installs it own libraries including Nginx under /opt. So you might be better off installing GitLab yourself on a clean droplet:
by Nik van der Ploeg
GitLab provides a simple but powerful web based interface to your Git repositories a la GitHub. Only you can host it on your own cloud server, control access as you see fit, and repo size is limited only by how much storage space your server has. This tutorial will walk you through setting up a DigitalOcean VPS as a GitLab server.


gitlab installer is using chef recipe to provision ngnix.
You can modify those recipies as is described here:

Have another answer? Share your knowledge.