我已经成功安装了使用nginx的gitlab(感谢这个线程: gitlab安装:使用本地主机 )。 我可以在本地主机上运行软件(http:// localhost会让我到gitlab的首页)。 所有这些都在一个虚拟软件。
我已经尝试将主机666端口映射到vmware ngnix 80端口。 所以,去http:// localhost:666应该会给我的gitlab的首页。
问题是:我只得到“欢迎使用nginx!” 页。
这是我的访问日志看起来像:
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-*
产生
/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
/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; # eg, listen 192.168.1.1:80; server_name localhost; # eg, 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; } }
“welcome to nginx”消息可能由于默认configuration而出现:
在/ etc / nginx的/网站可用/默认
我假设nginx在这里监听,并指向你一个nginx的欢迎页面。
移动/删除这个文件应该可以做到。 当然,如果我们能够清楚地看到这个文件里面的内容,就能更好地解释发生了什么,
感谢Ladadadada和Drew Khoury给我正确的方向去追求…
如果你在vmware中设置了gitlab服务器,那么你想从主机环境访问它,同时你想通过虚拟机访问它,那么你必须设置你的/etc/nginx/sites-available/default和/etc/nginx/sites-available/gitlab ,如下所示:
在/ etc / nginx的/网站可用/默认
server { listen 127.0.0.1:80 default_server; # eg, listen 192.168.1.1:80; server_name localhost; # eg, 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的/网站可用/ 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; # eg, listen 192.168.1.1:80; server_name localhost; # eg, 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; } }
请将192.168.21.136更改为您的VMware虚拟IP地址。 在主机中,您有“虚拟networking编辑器”(Virtual Network Editor)菜单,它是将vmware IP地址映射到某个端口的地方。