加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

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

发布时间:2020-12-13 21:01:54 所属栏目:Nginx 来源:网络整理
导读:我使用它的installation guide安装了gitlab.一切都还可以,但是当我在浏览器中打开localhost:80时,我看到它的消息欢迎来到nginx!.我找不到任何包含任何错误的日志文件. 我在VirtualBox中运行Ubuntu.我的/ etc / nginx / sites-enabled / gitlab配置文件读取

我使用它的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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读