카테고리 없음

Gitlab Apache Virtualhost로 사용 (reverse proxy)

GuriZzang 2019. 9. 9. 15:00

1. Gitlab Config 변경

$ sudo vi /etc/gitlab/gitlab.rb

// 주석제거 및 값 변경
> external_url 'http://도메인 혹은 아이피'
> web_server['external_users'] = ['아파치 사용자', 'www-data']
> nginx['enable'] = false

 

2. Apache proxy관련 모듈 허용

// proxy관련 모듈 허용
$ sudo a2enmod proxy
$ sudo a2enmod proxy_balancer
$ sudo a2enmod proxy_http
$ sudo a2enmod rewrite

 

3. Apache Virtualhost 등록

<VirtualHost *:80>
  ServerName [자신의 도메인]
  ServerSignature Off
 
  ProxyPreserveHost On
 
  <Location />
    Order deny,allow
    Allow from all
 
    ProxyPassReverse http://127.0.0.1:8080
    ProxyPassReverse http://gitlab.example.com/
  </Location>
 
  RewriteEngine on
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]
 
  # needed for downloading attachments
  DocumentRoot /opt/gitlab/embedded/service/gitlab-rails/public
</VirtualHost>

 

4. 마지막으로 Gitlab reconfiture 및 Apache restart

$ sudo gitlab-ctl reconfigure
$ sudo systemctl restart apache2 (혹은 $ sudo service apache2 restart)