Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed gitlab on my server and use nginx as http server... I simply used recipe for gitlab on nginx

# Maintainer: @randx
# App Version: 3.0

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

server {
  listen;         # e.g., listen;
  server_name;     # e.g., server_name;
  root /home/gitlab/gitlab/public;

  # 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; #
    proxy_connect_timeout 300; #
    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;
} works fine and i get gitlab web documents. But if i want another subdomain i use for Jira ( on port 80 (i setup jira on 8080 port normally) gets gitlab web site also.

How can i restrict this rule only serving for gitlab, or may be i can redirect to

share|improve this question
Where is your server block for Jira? – Michael Hampton Dec 17 '12 at 18:05
What do you mean by that ? jira and gitlab are on the same server, gitlab has nginx as server, and jira has apache tomcat. jira runs on 8080 port. but if i dont write down port number in address as , nginz responses and i get gitlab site. – Alkimake Dec 18 '12 at 19:07

Set up another server block, and mark it as default in listen directive.

share|improve this answer
now gitlab is not working – Alkimake Jan 10 '13 at 12:33
did you access it by full name, – sendmoreinfo Jan 10 '13 at 18:10
normally yes... – Alkimake Jan 11 '13 at 11:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.