2017-11-28 6 views
0

リバース:サブドメイン+ nginxの+はそうのようなgitlab +ウェブサイト+ジェンキンスを実行する方法の完全なガイドや説明のためのインターネットを検索するプロキシ+ジェンキンス+ gitlab

  • ジェンキンス@ jenkins.domain.com
  • GitLab @ gitlab.domain.com
  • 静的なウェブサイトの@ domain.comサーバー上の

すなわち特定のサービスおよびサブドメインを経由してそれらへのアクセスを持って、私が発見し、答えていません。

我々は、Ubuntuを使用してnginxのと私たちはnginxのウェルカムページを見ることができるドメイン名example.comと当社のIPアドレス111.111.111.111に

を指しているレコードを持っています。

サブドメインはどのように解決されていますか?それらを作成する場所? サーバーがDNSになることはできますか? 最終的なnginx confとは何でしょうか?

それは静的なウェブサイトを提供するために必要とジェンキンスためと404

server { 
    access_log  logs/landing.access.log; 
    server_name  example.com; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

    location/{ 
    root /var/www/html/landing; 
    index index.html; 
    } 

    location /app { 
    proxy_pass  http://localhost:9981; 
    } 

    location ^~ /jenkins { 
    proxy_pass   http://127.0.0.1:9990; 
    proxy_read_timeout 90; 

    # Fix the “It appears that your reverse proxy set up is broken" error. 
    proxy_redirect  http://127.0.0.1:9990 $scheme://example.com; 

    # Optionally, require HTTP basic auth. 
    # auth_basic "Please authenticate to use Jenkins"; 
    # auth_basic_user_file /opt/nginx/htpasswd; 
    } 
} 

の結果は、別のサーバブロックがそこすべきであると静的なファイルを提供しようとするので、この1つは、間違っていますか?私がexample.comないsubdomain.example.com経由でアクセスしようとしているよう

server { 
    access_log  logs/jenkins.access.log; 
    server_name  jenkins example.com; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

    proxy_pass   http://127.0.0.1:9990; 
} 

しかし、この1つは別の理由のために404を与えるが、私は、最初のもので、この第二ブロックの衝突を想定しています。また、subdomain.example.comは解決されません。

答えて

1

さて、あなたはいくつかの質問があります。最初のDNS関連の質問。 domain.tldがある場合は、そのドメインのDNSを管理しているユーザに移動し、nginxサーバを指すCNAMEまたはAレコードを追加します。

Jenkinsnginxの設定です。私はjenkins.domain.tld.confのような新しいファイルを作成し、各サブドメインはGoogleに行くとサービスnginxを検索し、あなたがそれを設定するにはどうすればよいの助言を見つける必要があるため、私はhere

server { 

    listen 80; 
    server_name jenkins.domain.tld; 

    location/{ 

     proxy_set_header  Host $host:$server_port; 
     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; 

     # Fix the "It appears that your reverse proxy set up is broken" error. 
     proxy_pass   http://127.0.0.1:8080; 
     proxy_read_timeout 90; 

     proxy_redirect  http://127.0.0.1:8080 https://jenkins.domain.tld; 

     # Required for new HTTP-based CLI 
     proxy_http_version 1.1; 
     proxy_request_buffering off; 
     # workaround for https://issues.jenkins-ci.org/browse/JENKINS-45651 
     add_header 'X-SSH-Endpoint' 'jenkins.domain.tld:50022' always;  
    } 
    } 

からコピーされ、この中に入れてしまうでしょう。

+0

誰が最終的にサブドメインを解決するのですか? –

+0

あなたのネームサーバーは、各サブドメインのnginxサーバーを指しています。 –

+0

サブドメインはどこにでも定義する必要がありますか?私はnginxのサーバーブロックでそれらを書く場合? –

関連する問題