私はnginxが初めてです。ポート 80 で現在 Apache によって提供されている既存の php プロジェクトと一緒に GitLabs をインストールしようとしています。私の計画は、両方をポート 90 で並べて動作させてから、Apache をオフにして、両方のプロジェクトをポート 80 で Nginx に切り替えることです。 .
わかった。問題は、両方のサブドメインがserver
for my php プロジェクトによってキャプチャされていることですdb.mydomain.com
。php プロジェクトには、ccdb
symlinked intoというファイルがあります/etc/nginx/sites-enabled
。を含む:
server {
server_name db.mydomain.com;
listen 90; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /var/www/ccdb;
index index.html index.htm index.php;
}
ただし、何らかの理由で、このコンテンツで/var/www/ccdb
呼び出されたファイルと一緒にシンボリックリンクされた別のファイルがあるにもかかわらず、git.mydomain.com へのトラフィックがサーバー化されています。gitlab
# GITLAB
# Maintainer: @randx
# App Version: 5.0
upstream gitlab {
server unix:/home/git/gitlab/tmp/sockets/gitlab.socket;
}
server {
listen 90; # e.g., listen 192.168.1.1:80; In most cases *:80 is a good idea
server_name git.mydomain.com; # e.g., server_name source.example.com;
server_tokens off; # don't show the version number, a security best practice
root /home/git/gitlab/public;
# individual nginx logs for this gitlab vhost
access_log /var/log/nginx/gitlab_access.log;
error_log /var/log/nginx/gitlab_error.log;
location / {
# 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 pass the request to the upsteam (gitlab unicorn)
location @gitlab {
proxy_read_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_connect_timeout 300; # https://github.com/gitlabhq/gitlabhq/issues/694
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://gitlab;
}
}
注: 次の/etc/hosts
ようにファイルにエントリがある同じローカル ネットワーク上の OSX マシンから 2 つのドメインにアクセスしています。
192.168.1.100 db.mydomain.com
192.168.1.100 git.mydomain.com