
我有 2 台伺服器:
- 第一:包含gitlab + apache代理,在我的內部網路域git.development上
- 第二:伺服器前端只有 nginx,在我的公共網域 git.mydomain.com 上
我想在第二台伺服器的 gitlab 目錄“public”上“chrooted”。
公共 Web 伺服器的目錄「public」基礎:git.development/public ----> git.mydomain.com
無需登入即可重定向到基地:git.mydomain.com/users/sign_in ----> git.mydomain.com
目前我有部分設定:
伺服器 1 上的 apache(工作沒有問題)
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName git.development
ProxyRequests Off
<Proxy http://127.0.0.1:8082/*>
Order deny,allow
Allow from 192.168.0. 127.0.0.1
</Proxy>
ProxyPreserveHost On
ProxyPass /uploads !
ProxyPass /error !
ProxyPass / http://127.0.0.1:8082/
CustomLog ${APACHE_LOG_DIR}/development.3.git.access.log combined
ErrorLog ${APACHE_LOG_DIR}/development.3.git.error.log
# Modify path to your needs (needed for downloading attachments)
DocumentRoot /home/git/gitlab/public
<Location />
Order allow,deny
Allow from all
</Location>
第二台有 nginx 的伺服器(或多或少工作):
server
{
listen 80;
access_log off;
server_name git.mydomain.com;
# select the correct apache subdomain
proxy_set_header Host git.development;
rewrite ^/public(/.*)$ $1 last;
location / {
proxy_pass http://git.development/public/;
proxy_cache cache;
proxy_cache_valid 12h;
expires 12h;
proxy_cache_use_stale error timeout invalid_header updating;
}
location ~*^.+(swf|ttf|woff|jpg|jpeg|gif|png|ico|css|txt|mid|midi|wav|bmp|rtf|js)$ `{`
proxy_pass http://git.development;
proxy_cache cache;
proxy_cache_valid 10d;
expires max;
}
}
實際上,我不知道在技術上是否可以在另一個目錄上強制執行公共網路伺服器而不干擾gitlab 的工作,也許這對於此類事情來說不是一個好方法,而且具有類似問題的連結也可以幫助我。