为什么Gitlab实例可以从多个子域访问



我在Digital Ocean上有一个ubuntu 14.04服务器,我在那里运行一个Gitlab实例,可以从repo.mydomain.com访问我想设置一个toran实例,它必须可以从toran.mydomain.com 访问

然而,我注意到,对于指向服务器的每个子域,都会显示Gitlab登录页面。因此,当我浏览到toran.mydomain.com甚至test.mydomain.com时,它会显示Gitlab页面。我该怎么解决这个问题

Gitlab配置

我已经修改了gitlab的一些原始配置,一个重要的修改是使用我自己的nginx实例,而不是内置实例,遵循本指南。

我的gitlab配置(我使用了伪值(如下:

external_url 'http://repo.mydomain.com'
 gitlab_rails['gitlab_email_from'] = 'emailhere'
 gitlab_rails['gitlab_email_display_name'] = 'Gitlab'
 gitlab_rails['db_adapter'] = "postgresql"
 gitlab_rails['db_encoding'] = "unicode"
 gitlab_rails['db_database'] = "thdbname"
# gitlab_rails['db_pool'] = 10
 gitlab_rails['db_username'] = "theuser"
 gitlab_rails['db_password'] = "thepass"
 gitlab_rails['db_host'] = "localhost"
 gitlab_rails['db_port'] = 1337
 gitlab_rails['smtp_enable'] = true
 gitlab_rails['smtp_address'] = "smtp.mandrillapp.com"
 gitlab_rails['smtp_port'] = 587
 gitlab_rails['smtp_user_name'] = "emailhere"
 gitlab_rails['smtp_password'] = "ojojowij"
 gitlab_rails['smtp_domain'] = "domainhere"
 gitlab_rails['smtp_authentication'] = "login"
 gitlab_rails['smtp_enable_starttls_auto'] = true
 postgresql['enable'] = false
 web_server['external_users'] = ['www-data']
 nginx['enable'] = false

gitlab的nginx配置如下:

server {
  listen *:80;
  server_name repo.mydomain.com;
  server_tokens off;
  root /opt/gitlab/embedded/service/gitlab-rails/public;
  client_max_body_size 250m;
  access_log  /var/log/gitlab/nginx/gitlab_access.log;
  error_log   /var/log/gitlab/nginx/gitlab_error.log error;
  # Ensure Passenger uses the bundled Ruby version
  passenger_ruby /opt/gitlab/embedded/bin/ruby;
  # Correct the $PATH variable to included packaged executables
  passenger_env_var PATH "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/usr/local/bin:/usr/bin:/bin";
  # Make sure Passenger runs as the correct user and group to
  # prevent permission issues
  passenger_user git;
  passenger_group git;
  # Enable Passenger & keep at least one instance running at all times
  passenger_enabled on;
  passenger_min_instances 1;
  error_page 502 /502.html;
}

Toran配置

 server {
    #listen 8000;
    listen *:8000;
    server_name toran.mydomain.com;
    root /var/www/toran/web;
    #index index.html index.htm;
    access_log  /var/log/toran/nginx/toran_access.log;
    error_log   /var/log/toran/nginx/toran_error.log error;
    location / {
        try_files $uri /app.php$is_args$args;
    }
 }

它不是Gitlab,而是与Nginx相关的。请看这个答案:为什么nginx响应任何域名?

使Toran服务器块侦听端口80:

server {
  listen 80;
  ...
}

相关内容

  • 没有找到相关文章

最新更新