Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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

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

server {
  listen 192.168.250.81:80;         # e.g., listen 192.168.1.1:80;
  server_name gitlab.xxx.com;     # e.g., server_name source.example.com;
  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; # 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;
  }
}

gitlab.xxx.com works fine and i get gitlab web documents. But if i want another subdomain i use for Jira (jira.xxx.com) 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 jira.xxx.com to jira.xxx.com:8080

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 jira.matriksdata.com , nginz responses and i get gitlab site. –  Alkimake Dec 18 '12 at 19:07
add comment

1 Answer

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, gitlab.xxx.com? –  sendmoreinfo Jan 10 '13 at 18:10
    
normally yes... –  Alkimake Jan 11 '13 at 11:24
add comment

Your Answer

 
discard

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.