は、例えば、gitlab 7.4.5、何gitlab-のgit-HTTPサーバ(gitlab-主力)は存在しません。しかし、gitlab 7.4.5がdocでsuburiを使うためのいくつかの解決策があります。 gitlab 7.4の設定
config/application.rb
# Relative url support
# Uncomment and customize the last line to run in a non-root path
# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this.
# Note that following settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"
# 5) In lib/support/nginx/gitlab : do not use asset gzipping, remove block starting with "location ~ ^/(assets)/"
#
# To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
#
# config.relative_url_root = "/gitlab"
config/gitlab.yml
# WARNING: See config/application.rb under "Relative url support" for the list of
# other files that need to be changed for relative url support
# relative_url_root: /gitlab
。5とnginx設定やapache設定ファイルの同じポート名と同じドメイン名を使用している他のウェブサイトとの接続はまだ難しいようです。私はこれを得ていない。私はwww.mydomain.com/gitlabとしてgitlabにアクセスすることができますが、他のルートディレクトリにwww.mydomain.comという別のWebサイトを持っていません。これはconfigure nginxまたはapacheによって拒否されるべきです。 nginxやapacheに精通している人々が解決策を提供できることを願っています。
その他の参考資料。 Support installing GitLab in a relative URL path or sub directory #1950
EDIT
は、それが動作するようになりました。
stackoverflowここで例としてwww.example.comを使用することをお勧めします。
www.example.com/gitlab access gitlab
www.example.com他のウェブサイト、たとえば、私のブログにアクセスしてください。
ステップ:
- のconfig/application.rbファイル:config.relative_url_root = "/ gitlab"
- のconfig/gitlab.ymlファイル:relative_url_root:/ gitlab
- のconfig/unicorn.rb: ENV [ 'RAILS_RELATIVE_URL_ROOT'] = "/ gitlab"
- ../gitlab-shell/config.yml:gitlab_url:nginxのためgitlab.confすると、資産を使用していない
"http://www.example.com/gitlab"
- コピーのlib /サポート/ nginxの/ gitlab gzipping、ブロックスターを削除ティン
"location ~^/(assets)/"
- 実行とします。sudo -u gitの-Hのexecすくい資産バンドル:プリコンパイル RAILS_ENVを=生産
のURL:
- のconfig/gitlab.ymlファイル:ホスト:example.comポート:80
- のconfig/unicorn.rb:聞く "127.0.0.1:9095"
- ../gitlab-shell/config.yml:gitlab_url:
http://www.example.com/gitlab
私は、HTTPSを使用していないサンプルproject.git
- http://example.com/gitlab/sample-project.git
:
- [email protected]:
gitlabはgitのにアクセスするには2つの方法を提供します。
あなたが得た場合:
をあなたはhost: example.com/gitlab
としてconfig/gitlab.yml
を構成することができます。 /gitlab
を削除するだけです。
nginxの設定ファイル:
###################################
## configuration ##
###################################
##
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket fail_timeout=0;
}
## Normal HTTP host
server {
#listen *:80 default_server;
listen *:80 default_server;
server_name www.example.com; ## Replace this with something like gitlab.example.com
server_tokens off; ## Don't show the nginx version number, a security best practice
#root /home/git/gitlab/public;
root html;
location /{
#root html;
index index.html index.htm;
}
## Increase this if you want to upload large attachments
## Or if you want to accept large git objects over http
client_max_body_size 20m;
## Individual nginx logs for this GitLab vhost
access_log logs/example.gitlab_access.log;
error_log logs/example.gitlab_error.log;
location /gitlab {
alias /home/git/gitlab/public;
## 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 passes the request to the upsteam (gitlab unicorn).
location @gitlab {
## If you use HTTPS make sure you disable gzip compression
## to be safe against BREACH attack.
# gzip off;
## https://github.com/gitlabhq/gitlabhq/issues/694
## Some requests take more than 30 seconds.
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab;
}
## Enable gzip compression as per rails guide:
## http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
## WARNING: If you are using relative urls remove the block below
## See config/application.rb under "Relative url support" for the list of
## other files that need to be changed for relative url support
#location ~ ^/(assets)/ {
# root /home/git/gitlab/public;
# #gzip_static on; # to serve pre-gzipped version
# expires max;
# add_header Cache-Control public;
#}
error_page 502 /502.html;
}
アパッチ(2.2.9)設定ファイル:gitlab 6.0.6リファレンスgitlab.confとgitlab-8.0-apache2.2.conf gitlab 8.0.0用のApache 2.2
# Module dependencies
# mod_rewrite
# mod_proxy
# mod_proxy_http
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/data/webapp/www/wordpress"
ServerName www.example.com
ServerAlias example.com
#ErrorLog "logs/wordpress-error_log"
#CustomLog "logs/wordpress-access_log" common
#SetEnv ZF2_PATH "/data/webapp/www/ZendFramework-2.3.3/library"
SetEnv APPLICATION_ENV "development"
<Directory /data/webapp/www/wordpress>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
#ServerName www.example.com
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
<Location /gitlab>
Order deny,allow
Allow from all
ProxyPassReverse http://127.0.0.1:9095
ProxyPassReverse http://www.example.com//
RewriteEngine on
#RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:9095%{REQUEST_URI} [P,QSA,NE]
</Location>
#apache equivalent of nginx try files
# http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files
# http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab
# RewriteEngine on
# RewriteCond /code/gitlab/{REQUEST_FILENAME} !-f
# RewriteRule .* http://127.0.0.1:9095%{REQUEST_URI} [P,QSA,NE]
# needed for downloading attachments
#DocumentRoot /home/git/gitlab/public
Alias /gitlab /home/git/gitlab/public
#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 logs/example.com_error.log
CustomLog logs/example.com_forwarded.log common_forwarded
CustomLog logs/example.com_access.log combined env=!dontlog
CustomLog logs/example.com.log combined
</VirtualHost>
のは、私が持っています元の質問と同様の問題が発生し、解決方法を試しました。私のエラーログには新しいエントリはなく、これだけでは問題は解決しないようです。私がやっていることは、あなたの提案を次のようなものに適用することです:http://unicorn.bogomips.org/examples/nginx.conf。 –