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

I have successfully installed gitlab which use nginx (Thanks to this thread: gitlab installation: using localhost). I can run the software in localhost (http:// localhost will get me to gitlab front page). All of this are in a vmware.

I have tried mapping the host 666 port to the vmware ngnix 80 port. So, going to http:// localhost:666 supposedly will give me the gitlab front page.

The problem is: I only get "Welcome to nginx!" page.

This is what my access log looks like:

10.1.17.74 - - [25/Mar/2013:00:24:59 -0700] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22"

-

ls -l /etc/nginx/sites-*

produces

/etc/nginx/sites-available:
total 8
-rw-r--r-- 1 root root 2496 2011-02-25 19:20 default
-rw-r--r-- 1 root root 1198 2013-03-24 09:12 gitlab

/etc/nginx/sites-enabled:
total 0
lrwxrwxrwx 1 root root 34 2013-03-24 03:59 default -> /etc/nginx/sites-available/default
lrwxrwxrwx 1 root root 33 2013-03-24 04:00 gitlab -> /etc/nginx/sites-available/gitlab

Contents of /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 127.0.0.1:80 default_server;         # e.g., listen 192.168.1.1:80;
  server_name localhost;     # e.g., server_name source.example.com;
  root /home/git/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;
  }
}
share|improve this question
    
What is the output of ls -l /etc/nginx/sites-* and what are the contents of /etc/nginx/sites-available/gitlab? (Please add them to your question.) –  Ladadadada Mar 25 '13 at 13:39
    
@Ladadadada, I have update my question :) –  Iyas Mar 27 '13 at 2:55

2 Answers 2

The "welcome to nginx" message is probably coming up because of the default config:

/etc/nginx/sites-available/default

I assume nginx is listening here, and pointing you to an nginx welcome page.

Moving/Removing this file should do the trick. Of course it would be neat if we could see exactly what inside that file to better explain what is going on.

share|improve this answer
    
I don't know how to remove the file. But I do change the server listen from server { listen 127.0.0.1:80 default_server; to server { listen 192.168.1.35:80 default_server; which solve my problem but raise another one which is, I cannot access the gitlab page from inside the vmware. –  Iyas Mar 27 '13 at 6:06
    
When i deleted the file, localhost cannot be accessed. here is the content: server { root /usr/share/nginx/www; index index.html index.htm; server_name localhost; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } location /doc { root /usr/share; autoindex on; allow 127.0.0.1; deny all; } location /images { root /usr/share; autoindex off; } } –  Iyas Mar 27 '13 at 9:29
up vote 0 down vote accepted

Thanks to Ladadadada and Drew Khoury for giving me the right direction to pursue...

If you set up gitlab server in a vmware, then you want to access it from host environment, in the same time, you want to be able to access it via the virtual machine, then you have to set your /etc/nginx/sites-available/default and /etc/nginx/sites-available/gitlab as follows:

/etc/nginx/sites-available/default

server {
  listen 127.0.0.1:80 default_server;         # e.g., listen 192.168.1.1:80;
  server_name localhost;     # e.g., server_name source.example.com;
  root /home/git/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;
  }
}

/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 192.168.21.136:80 default_server;         # e.g., listen 192.168.1.1:80;
  server_name localhost;     # e.g., server_name source.example.com;
  root /home/git/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;
  }
}

Please change 192.168.21.136 to your vmware IP Address. In the host machine, you have 'Virtual Network Editor' menu which is the place where you map the vmware IP Address to certain port.

share|improve this answer

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.