3

I have setup GitLab on my unbuntu ubuntu 12.04 lts server in following path /home/git/gitlab/. I am using nginx server.
This is my gitlab status

root@c27-76:/etc# sudo service gitlab status
The GitLab Unicorn web server with pid 3187 is running.
The GitLab Sidekiq job dispatcher with pid 3197 is running.
GitLab and all its components are up and running.

I am having trouble to setup sub domain on for gitlab. I want a domain like gitlab.domain.com.

This is my gitlab file on /etc/nginx/sites-avaliable

server {
    listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

    root /home/git/gitlab/;
    index index.html index.htm index.php;

    # Make site accessible from http://localhost/
    server_name gitlab.ecut.eu;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ /index.html;
        # Uncomment to enable naxsi on this location
        # include /etc/nginx/naxsi.rules
    }

    location /doc/ {
        alias /usr/share/doc/;
        autoindex on;
        allow 127.0.0.1;
        allow ::1;
        deny all;
    }

 Nothings happens when i restart nginx.

This is my etc/hosts file

127.0.0.1       localhost.localdomain ecut.eu
::1     localhost ip6-localhost ip6-loopback
fe00::0     ip6-localnet
ff00::0     ip6-mcastprefix
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

127.0.0.1 startup2014.eu
localhost startup2014.eu



127.0.0.1 gitlab.ecut.eu
localhost gitlab.ecu.eu

# Auto-generated hostname. Please do not remove this comment.
217.146.76.27 c27-76.uvn.zone.eu c27-76

Please suggest me how can i fix this.

Thanks, Krishna

4
  • Have you linked it into sites-enabled? "Nothing happens" is bad description of the problem. You should write what you did, what's happened and what supposed to happen.
    – Alexey Ten
    Apr 10, 2014 at 7:28
  • 2
    You have at least a dns issue : Host gitlab.ecut.eu not found: 3(NXDOMAIN)
    – user130370
    Apr 10, 2014 at 7:44
  • how can i fix this dns issue? Apr 10, 2014 at 8:23
  • Add a DNS record (A or CNAME) for gitlab.ecut.eu against your server IP at you nameserver. Apr 10, 2014 at 9:30

1 Answer 1

1

Here is my working nginx configuration for gitlab. Subdomain should work fine if specified as server_name.

And as @eric-dannielou mentioned check so that /etc/nginx/sites-available/gitlab is symlinked in /etc/nginx/sites-enabled with:

ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab

/etc/nginx/sites-available/gitlab

# GITLAB
# Maintainer: @randx
# App Version: 5.0

upstream gitlab {
    server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}

server {
listen 80 default_server;         # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name git.domain.com;     # e.g., server_name source.example.com;
server_tokens off;     # don't show the version number, a security best practice
root /home/git/gitlab/public;
client_max_body_size 500m;

# individual nginx logs for this gitlab vhost
access_log  /var/log/nginx/gitlab_access.log;
error_log   /var/log/nginx/gitlab_error.log;

location / {
  # serve static files from defined root folder;.
  # @gitlab is a named location for the upstream fallback, see below
  try_files $uri $uri/index.html $uri.html @gitlab;
}

# if a file, which is not found in the root folder is requested,
# then the proxy pass the request to the upsteam (gitlab unicorn)
location @gitlab {
  proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
  proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
  proxy_redirect     off;

  proxy_set_header   X-Forwarded-Proto $scheme;
  proxy_set_header   Host              $http_host;
  proxy_set_header   X-Real-IP         $remote_addr;

  proxy_pass http://gitlab;
}
}
4
  • using this main site redirects to gitlab... I tried by commenting default sever listen 80; #default_server;. Still it doesn't work. Apr 10, 2014 at 9:52
  • I have edited the question and added host file. I m not sure i need to add line for subdomain or not in hostfile. Please check this. Thanks Apr 10, 2014 at 10:01
  • How dose you default config look like? And you still have to get you subdomain in DNS as now you will get; host gitlab.ecut.eu Host gitlab.ecut.eu not found: 3(NXDOMAIN) Apr 10, 2014 at 11:10
  • my default config file is as same as default. i haven't touched that file. What does Host gitlab.ecut.eu not found: 3(NXDOMAIN) means? I m new to linux.. Thanks Apr 10, 2014 at 12:46

Not the answer you're looking for? Browse other questions tagged .