安装了gitlab,但只有nginx欢迎页面显示

我使用它的installation guide安装了gitlab.一切都还可以,但是当我在浏览器中打开localhost:80时,我看到它的消息欢迎来到nginx!.我找不到任何包含任何错误的日志文件.

我在VirtualBox中运行Ubuntu.我的/ etc / nginx / sites-enabled / gitlab配置文件读取:

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

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

server {
  listen 192.168.1.1:80;         # e.g.,listen 192.168.1.1:80;
  server_name aridev-VirtualBox;     # 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;
  }
}

最佳答案
nginx documentation说:

Server names are defined using the server_name directive and determine which server block is used for a given request. 

这意味着在您的情况下,您必须在浏览器中输入aridev-VirtualBox而不是localhost.

要使其正常工作,您必须在本地Hosts file中输入aridev-VirtualBox并将其指向VirtualBox PC的IP.

这看起来如下:

192.168.1.1 aridev-VirtualBox

dawei

【声明】:唐山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。