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

前端之家收集整理的这篇文章主要介绍了安装了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
原文链接:/nginx/434833.html

猜你在找的Nginx相关文章