从源代码更新gitlab,gitshell错误301

时间:2016-09-26 20:39:34

标签: apache gitlab

我正在将我的gitlab源安装升级到8.9.8版本。 我有一个相对路径配置和使用tha apache web服务器与ssl配置。 我跟着这个guide,但是当我检查isntall时,我遇到了一个gitshell安装问题;这里的日志:

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

Checking GitLab Shell ...    
GitLab Shell version >= 3.0.0 ? ... OK (3.0.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
hooks directories in repos are links: ... 
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 301
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.    
Checking GitLab Shell ... Finished    
Checking Sidekiq ...    
Running? ... yes
Number of Sidekiq processes ... 1    
Checking Sidekiq ... Finished    
Checking Reply by email ...    
Reply by email is disabled in config/gitlab.yml    
Checking Reply by email ... Finished    
Checking LDAP ...    
LDAP is disabled in config/gitlab.yml    
Checking LDAP ... Finished    
Checking GitLab ...    
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... yes
Init script exists? ... yes
Init script up-to-date? ... no
  Try fixing it:
  Redownload the init script
  For more information see:
  doc/install/installation.md in section "Install Init Script"
  Please fix the error above and rerun the checks.
projects have namespace: ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.1.6)
Your git bin path is "/usr/bin/git"
Git version >= 2.7.3 ? ... yes (2.7.4)
Active users: 6    
Checking GitLab ... Finished

对于我跟随此guide

的相对网址

这是我的/etc/init.d/gitlab配置

#! /bin/sh
### Environment variables
RAILS_ENV="production"

# Script variable names should be lower-case not to conflict with
# internal /bin/sh variables such as PATH, EDITOR or SHELL.
app_user="git"
app_root="/home/$app_user/gitlab"
pid_path="$app_root/tmp/pids"
socket_path="$app_root/tmp/sockets"
rails_socket="$socket_path/gitlab.socket"
web_server_pid_path="$pid_path/unicorn.pid"
sidekiq_pid_path="$pid_path/sidekiq.pid"
mail_room_enabled=false
mail_room_pid_path="$pid_path/mail_room.pid"
gitlab_workhorse_dir=$(cd $app_root/../gitlab-workhorse 2> /dev/null && pwd)
gitlab_workhorse_pid_path="$pid_path/gitlab-workhorse.pid"
gitlab_workhorse_options="-listenNetwork tcp -listenAddr http://127.0.0.1:8181 -authBackend http://127.0.0.1:8080/gitlab -authSocket $rails_socket -documentRoot $app_root/public"
#gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080/gitlab -authSocket $rails_socket -documentRoot $app_root/public"
gitlab_workhorse_log="$app_root/log/gitlab-workhorse.log"
shell_path="/bin/bash"

# Read configuration variable file if it is present
test -f /etc/default/gitlab && . /etc/default/gitlab

# Switch to the app_user if it is not he/she who is running the script.
if [ `whoami` != "$app_user" ]; then
  eval su - "$app_user" -c $(echo \")$shell_path -l -c \'$0 "$@"\'$(echo \"); exit;
fi

# Switch to the gitlab path, exit on failure.
if ! cd "$app_root" ; then
 echo "Failed to cd into $app_root, exiting!";  exit 1
fi

### Init Script functions

## Gets the pids from the files
check_pids(){
  if ! mkdir -p "$pid_path"; then
    echo "Could not create the path $pid_path needed to store the pids."
    exit 1
  fi
  # If there exists a file which should hold the value of the Unicorn pid: read it.
  if [ -f "$web_server_pid_path" ]; then
    wpid=$(cat "$web_server_pid_path")
  else
    wpid=0
  fi
  if [ -f "$sidekiq_pid_path" ]; then
    spid=$(cat "$sidekiq_pid_path")
  else
    spid=0
  fi
  if [ -f "$gitlab_workhorse_pid_path" ]; then
    hpid=$(cat "$gitlab_workhorse_pid_path")
  else
    hpid=0
  fi
  if [ "$mail_room_enabled" = true ]; then
    if [ -f "$mail_room_pid_path" ]; then
      mpid=$(cat "$mail_room_pid_path")
    else
      mpid=0
    fi
  fi
}

## Called when we have started the two processes and are waiting for their pid files.
wait_for_pids(){
  # We are sleeping a bit here mostly because sidekiq is slow at writing its pid
  i=0;
  while [ ! -f $web_server_pid_path ] || [ ! -f $sidekiq_pid_path ] || [ ! -f $gitlab_workhorse_pid_path ] || { [ "$mail_room_enabled" = true ] && [ ! -f $mail_room_pid_path ]; }; do
    sleep 0.1;
    i=$((i+1))
    if [ $((i%10)) = 0 ]; then
      echo -n "."
    elif [ $((i)) = 301 ]; then
      echo "Waited 30s for the processes to write their pids, something probably went wrong."
      exit 1;
    fi
  done
  echo
}
 check_status(){
      check_pids
      if [ $wpid -ne 0 ]; then
        kill -0 "$wpid" 2>/dev/null
        web_status="$?"
      else
        web_status="-1"
      fi
      if [ $spid -ne 0 ]; then
        kill -0 "$spid" 2>/dev/null
        sidekiq_status="$?"
      else
        sidekiq_status="-1"
      fi
      if [ $hpid -ne 0 ]; then
        kill -0 "$hpid" 2>/dev/null
        gitlab_workhorse_status="$?"
      else
        gitlab_workhorse_status="-1"
      fi
      if [ "$mail_room_enabled" = true ]; then
        if [ $mpid -ne 0 ]; then
          kill -0 "$mpid" 2>/dev/null
          mail_room_status="$?"
        else
          mail_room_status="-1"
        fi
      fi
      if [ $web_status = 0 ] && [ $sidekiq_status = 0 ] && [ $gitlab_workhorse_status = 0 ] && { [ "$mail_room_enabled" != true ] || [ $mail_room_status = 0 ]; }; then
        gitlab_status=0
      else
        gitlab_status=3
      fi
    }    
    check_stale_pids(){
  check_status     
  if [ "$wpid" != "0" ] && [ "$web_status" != "0" ]; then
    echo "Removing stale Unicorn web server pid. This is most likely caused by the web server crashing the last time it ran."
    if ! rm "$web_server_pid_path"; then
      echo "Unable to remove stale pid, exiting."
      exit 1
    fi
 fi
  if [ "$hpid" != "0" ] && [ "$gitlab_workhorse_status" != "0" ]; then
    echo "Removing stale GitLab Workhorse pid. This is most likely caused by GitLab Workhorse crashing the last time it ran."
    if ! rm "$gitlab_workhorse_pid_path"; then
      echo "Unable to remove stale pid, exiting"
      exit 1
    fi
  fi
  if [ "$mail_room_enabled" = true ] && [ "$mpid" != "0" ] && [ "$mail_room_status" != "0" ]; then
    echo "Removing stale MailRoom job dispatcher pid. This is most likely caused by MailRoom crashing the last time it ran."
    if ! rm "$mail_room_pid_path"; then
      echo "Unable to remove stale pid, exiting"
      exit 1
    fi
  fi
}    
exit_if_not_running(){
  check_stale_pids
  if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && [ "$gitlab_workhorse_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then
    echo "GitLab is not running."
    exit
  fi
}    
start_gitlab() {
  check_stale_pids

  if [ "$web_status" != "0" ]; then
    echo "Starting GitLab Unicorn"
  fi
  if [ "$sidekiq_status" != "0" ]; then
    echo "Starting GitLab Sidekiq"
  fi
  if [ "$gitlab_workhorse_status" != "0" ]; then
    echo "Starting GitLab Workhorse"
  fi
  if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" != "0" ]; then
    echo "Starting GitLab MailRoom"
  fi

  # Then check if the service is running. If it is: don't start again.
  if [ "$web_status" = "0" ]; then
    echo "The Unicorn web server already running with pid $wpid, not restarting."
  else
  # Remove old socket if it exists
    rm -f "$rails_socket" 2>/dev/null
    # Start the web server
    RAILS_ENV=$RAILS_ENV bin/web start
  fi

  # If sidekiq is already running, don't start it again.
  if [ "$sidekiq_status" = "0" ]; then
    echo "The Sidekiq job dispatcher is already running with pid $spid, not restarting"
  else
    RAILS_ENV=$RAILS_ENV bin/background_jobs start &
  fi

  if [ "$gitlab_workhorse_status" = "0" ]; then
    echo "The GitLab Workhorse is already running with pid $spid, not restarting"
  else
    $app_root/bin/daemon_with_pidfile $gitlab_workhorse_pid_path  \
      /usr/bin/env PATH=$gitlab_workhorse_dir:$PATH \
        gitlab-workhorse $gitlab_workhorse_options \
      >> $gitlab_workhorse_log 2>&1 &
  fi

  if [ "$mail_room_enabled" = true ]; then
    # If MailRoom is already running, don't start it again.
    if [ "$mail_room_status" = "0" ]; then
      echo "The MailRoom email processor is already running with pid $mpid, not restarting"
    else
      RAILS_ENV=$RAILS_ENV bin/mail_room start &
    fi
  fi

  wait_for_pids   
  print_status
}

stop_gitlab() {
  exit_if_not_running

  if [ "$web_status" = "0" ]; then
    echo "Shutting down GitLab Unicorn"
    RAILS_ENV=$RAILS_ENV bin/web stop
  fi
  if [ "$sidekiq_status" = "0" ]; then
    echo "Shutting down GitLab Sidekiq"
    RAILS_ENV=$RAILS_ENV bin/background_jobs stop
  fi
  if [ "$gitlab_workhorse_status" = "0" ]; then
    echo "Shutting down GitLab Workhorse"
  kill -- $(cat $gitlab_workhorse_pid_path)
  fi
  if [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; then
    echo "Shutting down GitLab MailRoom"
    RAILS_ENV=$RAILS_ENV bin/mail_room stop
  fi

  # If something needs to be stopped, lets wait for it to stop. Never use SIGKILL in a script.
  while [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || [ "$gitlab_workhorse_status" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; }; do
    sleep 1
    check_status
    printf "."
    if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && [ "$gitlab_workhorse_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then
      printf "\n"
      break
    fi
  done

  sleep 1
  # Cleaning up unused pids
  rm "$web_server_pid_path" 2>/dev/null
  # rm "$sidekiq_pid_path" 2>/dev/null # Sidekiq seems to be cleaning up its own pid.
  rm -f "$gitlab_workhorse_pid_path"
  if [ "$mail_room_enabled" = true ]; then
    rm "$mail_room_pid_path" 2>/dev/null
  fi

  print_status
}

## Prints the status of GitLab and its components.
print_status() {
  check_status
  if [ "$web_status" != "0" ] && [ "$sidekiq_status" != "0" ] && [ "$gitlab_workhorse_status" != "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" != "0" ]; }; then
    echo "GitLab is not running."
    return
  fi
  if [ "$web_status" = "0" ]; then
      echo "The GitLab Unicorn web server with pid $wpid is running."
  else
      printf "The GitLab Unicorn web server is \033[31mnot running\033[0m.\n"
  fi
  if [ "$sidekiq_status" = "0" ]; then
      echo "The GitLab Sidekiq job dispatcher with pid $spid is running."
  else
      printf "The GitLab Sidekiq job dispatcher is \033[31mnot running\033[0m.\n"
  fi
  if [ "$gitlab_workhorse_status" = "0" ]; then
      echo "The GitLab Workhorse with pid $hpid is running."
  else
      printf "The GitLab Workhorse is \033[31mnot running\033[0m.\n"
  fi
  if [ "$mail_room_enabled" = true ]; then
    if [ "$mail_room_status" = "0" ]; then
  echo "The GitLab MailRoom email processor with pid $mpid is running."
    else
        printf "The GitLab MailRoom email processor is \033[31mnot running\033[0m.\n"
    fi
  fi
  if [ "$web_status" = "0" ] && [ "$sidekiq_status" = "0" ] && [ "$gitlab_workhorse_status" = "0" ] && { [ "$mail_room_enabled" != true ] || [ "$mail_room_status" = "0" ]; }; then
    printf "GitLab and all its components are \033[32mup and running\033[0m.\n"
  fi
}

## Tells unicorn to reload its config and Sidekiq to restart
reload_gitlab(){
  exit_if_not_running
  if [ "$wpid" = "0" ];then
    echo "The GitLab Unicorn Web server is not running thus its configuration can't be reloaded."
    exit 1
  fi
  printf "Reloading GitLab Unicorn configuration... "
  RAILS_ENV=$RAILS_ENV bin/web reload
  echo "Done."

  echo "Restarting GitLab Sidekiq since it isn't capable of reloading its config..."
  RAILS_ENV=$RAILS_ENV bin/background_jobs restart

  if [ "$mail_room_enabled" != true ]; then
    echo "Restarting GitLab MailRoom since it isn't capable of reloading its config..."
    RAILS_ENV=$RAILS_ENV bin/mail_room restart
  fi

  wait_for_pids
  print_status
}

## Restarts Sidekiq and Unicorn.
restart_gitlab(){
  check_status
  if [ "$web_status" = "0" ] || [ "$sidekiq_status" = "0" ] || [ "$gitlab_workhorse" = "0" ] || { [ "$mail_room_enabled" = true ] && [ "$mail_room_status" = "0" ]; }; then
    stop_gitlab
  fi
  start_gitlab
}


### Finally the input handling.

case "$1" in
  start)
        start_gitlab
        ;;
  stop)
        stop_gitlab
        ;;
  restart)
        restart_gitlab
        ;;
  reload|force-reload)
        reload_gitlab
        ;;
  status)
        print_status
        exit $gitlab_status
        ;;
  *)
        echo "Usage: service gitlab {start|stop|restart|reload|status}"
        exit 1
        ;;
esac

exit

我的/home/git/gittlab/conf/gitlab.yml文件:

production: &base

  gitlab:
    host: server.com
    port: 443 # Set to 443 if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
    https: true # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details

RAILS_ENV=production
from GitLab (default: true)

    email_from: gitlab@server.com
    email_display_name: GitLab
    email_reply_to: me@plop.com

    default_projects_features:
      issues: true
      merge_requests: true
      wiki: true
      snippets: false

    ## Webhook settings
    # Number of seconds to wait for HTTP response after sending webhook HTTP POST request (default: 10)
    # webhook_timeout: 10

    ## Repository downloads directory
    # When a user clicks e.g. 'Download zip' on a project, a temporary zip file is created in the following directory.
    # The default is 'tmp/repositories' relative to the root of the Rails app.
    # repository_downloads_path: tmp/repositories

  ## Gravatar
  ## For Libravatar see: http://doc.gitlab.com/ce/customization/libravatar.html
  gravatar:
    enabled: true                 # Use user avatar image from Gravatar.com (default: true)
    # gravatar urls: possible placeholders: %{hash} %{size} %{email}
    # plain_url: "http://..."     # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon
    # ssl_url:   "https://..."    # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon

  #
  # 2. Auth settings
  # ==========================

  ## LDAP settings
  # You can inspect a sample of the LDAP users with login access by running:
  #   bundle exec rake gitlab:ldap:check RAILS_ENV=production
  ldap:
    enabled: false
    servers:
      ##########################################################################
      #
      # Since GitLab 7.4, LDAP servers get ID's (below the ID is 'main'). GitLab
      # Enterprise Edition now supports connecting to multiple LDAP servers.
      #
      # If you are updating from the old (pre-7.4) syntax, you MUST give your
      # old server the ID 'main'.
      #
      ##########################################################################
      main: # 'main' is the GitLab 'provider ID' of this LDAP server
        ## label
        #
        # A human-friendly name for your LDAP server. It is OK to change the label later,
        # for instance if you find out it is too large to fit on the web page.
        #
        # Example: 'Paris' or 'Acme, Ltd.'
        label: 'LDAP'
      host: '_your_ldap_server'
        port: 389
        uid: 'sAMAccountName'
        method: 'plain' # "tls" or "ssl" or "plain"
        bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
        password: '_the_password_of_the_bind_user'

        # This setting specifies if LDAP server is Active Directory LDAP server.
        # For non AD servers it skips the AD specific queries.
        # If your LDAP server is not AD, set this to false.
        active_directory: true

        # If allow_username_or_email_login is enabled, GitLab will ignore everything
        # after the first '@' in the LDAP username submitted by the user on login.
        #
        # Example:
        # - the user enters 'jane.doe@example.com' and 'p@ssw0rd' as LDAP credentials;
        # - GitLab queries the LDAP server with 'jane.doe' and 'p@ssw0rd'.
        #
        # If you are using "uid: 'userPrincipalName'" on ActiveDirectory you need to
        # disable this setting, because the userPrincipalName contains an '@'.
        allow_username_or_email_login: false

        # To maintain tight control over the number of active users on your GitLab installation,
        # enable this setting to keep new users blocked until they have been cleared by the admin
        # (default: false).
        block_auto_created_users: false

        # Base where we can search for users
        #
        #   Ex. ou=People,dc=gitlab,dc=example
        #
        base: ''

        # Filter LDAP users
        #
        #   Format: RFC 4515 http://tools.ietf.org/search/rfc4515
        #   Ex. (employeeType=developer)
        #
        #   Note: GitLab does not support omniauth-ldap's custom filter syntax.
        #
        user_filter: ''

      # GitLab EE only: add more LDAP servers
      # Choose an ID made of a-z and 0-9 . This ID will be stored in the database
      # so that GitLab can remember which LDAP server a user belongs to.
      # uswest2:
      #   label:
      #   host:
      #   ....


  ## OmniAuth settings
  omniauth:
   # Allow login via Twitter, Google, etc. using OmniAuth providers
    enabled: false

    # Uncomment this to automatically sign in with a specific omniauth provider's without
    # showing GitLab's sign-in page (default: show the GitLab sign-in page)
    # auto_sign_in_with_provider: saml

    # CAUTION!
    # This allows users to login without having a user account first (default: false).
    # User accounts will be created automatically when authentication was successful.
    allow_single_sign_on: false
    # Locks down those users until they have been cleared by the admin (default: true).
    block_auto_created_users: true
    # Look up new users in LDAP servers. If a match is found (same uid), automatically
    # link the omniauth identity with the LDAP account. (default: false)
    auto_link_ldap_user: false

    ## Auth providers
    # Uncomment the following lines and fill in the data of the auth provider you want to use
    # If your favorite auth provider is not listed you can use others:
    # see https://github.com/gitlabhq/gitlab-public-wiki/wiki/Custom-omniauth-provider-configurations
    # The 'app_id' and 'app_secret' parameters are always passed as the first two
    # arguments, followed by optional 'args' which can be either a hash or an array.
    # Documentation for this is available at http://doc.gitlab.com/ce/integration/omniauth.html
    providers:
      # - { name: 'google_oauth2', app_id: 'YOUR_APP_ID',
      #     app_secret: 'YOUR_APP_SECRET',
      #     args: { access_type: 'offline', approval_prompt: '' } }
      # - { name: 'twitter', app_id: 'YOUR_APP_ID',
      #     app_secret: 'YOUR_APP_SECRET'}
      # - { name: 'github', app_id: 'YOUR_APP_ID',
      #     app_secret: 'YOUR_APP_SECRET',
      #     args: { scope: 'user:email' } }
      # - { name: 'gitlab', app_id: 'YOUR_APP_ID',
      #     app_secret: 'YOUR_APP_SECRET',
      #     args: { scope: 'api' } }
      # - { name: 'bitbucket', app_id: 'YOUR_APP_ID',
      #     app_secret: 'YOUR_APP_SECRET'}
      # - { name: 'saml',
      #     args: {
      #             assertion_consumer_service_url: 'https://gitlab.example.com/users/auth/saml/callback',
      #             idp_cert_fingerprint: '43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8',
      #             idp_sso_target_url: 'https://login.example.com/idp',
      #             issuer: 'https://gitlab.example.com',
      #             name_identifier_format: 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
      #           } }




  #
  # 3. Advanced settings
  # ==========================
 # GitLab Satellites
  satellites:
    # Relative paths are relative to Rails.root (default: tmp/repo_satellites/)
    path: /home/git/gitlab-satellites/
    timeout: 30

  ## Backup settings
  backup:
    path: "tmp/backups"   # Relative paths are relative to Rails.root (default: tmp/backups/)
    # keep_time: 604800   # default: 0 (forever) (in seconds)
    # upload:
    #   # Fog storage connection settings, see http://fog.io/storage/ .
    #   connection:
    #     provider: AWS
    #     region: eu-west-1
    #     aws_access_key_id: AKIAKIAKI
    #     aws_secret_access_key: 'secret123'
    #   # The remote 'directory' to store your backups. For S3, this would be the bucket name.
    #   remote_directory: 'my.s3.bucket'
    #   # Use multipart uploads when file size reaches 100MB, see
    #   #  http://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
    #   multipart_chunk_size: 104857600

  ## GitLab Shell settings
  gitlab_shell:
    path: /home/git/gitlab-shell/

    # REPOS_PATH MUST NOT BE A SYMLINK!!!
    repos_path: /home/git/repositories/
    hooks_path: /home/git/gitlab-shell/hooks/

    # File that contains the secret key for verifying access for gitlab-shell.
    # Default is '.gitlab_shell_secret' relative to Rails.root (i.e. root of the GitLab app).
    # secret_file: /home/git/gitlab/.gitlab_shell_secret

    # Git over HTTP
    upload_pack: true
    receive_pack: true

    # If you use non-standard ssh port you need to specify it
    # ssh_port: 22

  ## Git settings
  # CAUTION!
  # Use the default values unless you really know what you are doing
  git:
    bin_path: /usr/bin/git

    # The next value is the maximum memory size grit can use
    # Given in number of bytes per git object (e.g. a commit)
    # This value can be increased if you have very large commits
    max_size: 209715200 # 20.megabytes
    # Git timeout to read a commit, in seconds
    timeout: 10
  #
  # 4. Extra customization
  # ==========================

  extra:
    ## Google analytics. Uncomment if you want it
    # google_analytics_id: '_your_tracking_id'

    ## Piwik analytics.
    # piwik_url: '_your_piwik_url'
    # piwik_site_id: '_your_piwik_site_id'

  rack_attack:
    git_basic_auth:

development:
  <<: *base

test:
  <<: *base
  gravatar:
    enabled: true
  gitlab:
    host: localhost
    port: 80

  satellites:
    path: tmp/tests/gitlab-satellites/
  gitlab_shell:
    path: tmp/tests/gitlab-shell/
    repos_path: tmp/tests/repositories/
    hooks_path: tmp/tests/gitlab-shell/hooks/
  issues_tracker:
    redmine:
      title: "Redmine"
      project_url: "http://redmine/projects/:issues_tracker_id"
      issues_url: "http://redmine/:project_id/:issues_tracker_id/:id"
      new_issue_url: "http://redmine/projects/:issues_tracker_id/issues/new"
  ldap:
    enabled: false
    servers:
   main:
        label: ldap
        host: 127.0.0.1
        port: 3890
        uid: 'uid'
        method: 'plain' # "tls" or "ssl" or "plain"
        base: 'dc=example,dc=com'
        user_filter: ''
        group_base: 'ou=groups,dc=example,dc=com'
        admin_group: ''
        sync_ssh_keys: false

staging:
  <<: *base

我的apache conf文件/etc/apache2/sites-enabled/site.conf

<VirtualHost *:80>

ServerSignature Off

DocumentRoot /var/www

Redirect permanent /gitlab https://server.com/gitlab


<directory /var/www>
require all granted
options FollowSymLinks
</directory>

</VirtualHost>

<VirtualHost *:443>
SSLEngine on
#strong encryption ciphers only
#see ciphers(1) http://www.openssl.org/docs/apps/ciphers.html
SSLCipherSuite SSLv3:TLSv1:+HIGH:!SSLv2:!MD5:!MEDIUM:!LOW:!EXP:!ADH:!eNULL:!aNULL
SSLCertificateFile    /etc/apache2/ssl/ssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/ssl.key
SSLCACertificateFile  /etc/apache2/ssl/ssl.crt

ServerSignature Off

ProxyPreserveHost On

# Ensure that encoded slashes are not decoded but left in their encoded state.
# http://doc.gitlab.com/ce/api/projects.html#get-single-project
AllowEncodedSlashes NoDecode

DocumentRoot /var/www

<Location /gitlab>
Order deny,allow
Allow from all
Require all granted
ProxyPassReverse http://127.0.0.1:8080
ProxyPassReverse http://server/gitlab
</Location>


RewriteEngine on
RewriteCond %{REQUEST_URI} ^.*/gitlab.*
RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
RequestHeader set X_FORWARDED_PROTO 'https'


#Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.
ErrorDocument 404 /404.html
ErrorDocument 422 /422.html
ErrorDocument 500 /500.html
ErrorDocument 503 /deploy.html

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded
ErrorLog  /var/log/apache2/error.log
CustomLog /var/log/apache2/forwarded.log common_forwarded
CustomLog /var/log/apache2/access.log combined env=!dontlog
CustomLog /var/log/apache2/log combined


<directory /var/www>
require all granted
options FollowSymLinks
</directory>
</directory>


<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
</IfModule>


</VirtualHost>

在目录/ var / www中有一个指向/ home / user / gitlab / public /

的符号链接

有人可以帮助我,谢谢。

PS:为了匹配30000个字符的限制,我抑制了评论

1 个答案:

答案 0 :(得分:0)

我解决了我的问题,

我删除所有配置文件并复制默认配置文件并使用原始nginx配置文件启动服务器。 然后,我遵循了服务器工作的每一步所确保的所有指南。

非常感谢