2017-11-28 2 views
0

+과 같이 gitlab 웹 사이트 + 젠킨스를 실행하는 방법에 대한 완전한 가이드와 설명은 인터넷 검색 역 :하위 도메인 +의 nginx + 프록시 + 젠킨스 + gitlab

  • 젠킨스 @ jenkins.domain.com
  • 을 GitLab @ gitlab.domain.com 서버에서
  • 정적 웹 사이트 @ domain.com을

즉, 특정 서비스 및 하위 도메인을 통해 그들에 액세스 할 수있는, 내가 발견 대답하지 않았습니다.

우리는 우분투,의 nginx를 실행하고 도메인 이름 example.com을 가지고 있고 A 레코드는 우리는 nginx를 시작 페이지를 볼 수있는 우리의 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; 
    } 
} 

에 결과 젠킨스과 정적 파일을 제공하려고하기 때문에

이 하나가 잘못? 내가 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; 
} 

하지만이 하나가 다른 이유로 404을 제공, 내가 처음이 2 블록의 충돌을 가정합니다. subdomain.example.com은 확인되지 않습니다.

답변

1

그럼 몇 가지 질문이 있습니다. 첫 번째 DNS 관련 질문. domain.tld가있는 경우 해당 도메인의 DNS를 관리하는 사람에게 가서 서버를 가리키는 CNAME 또는 A 레코드를 추가하십시오.

Jenkinsnginx 설정입니다. 나는 jenkins.domain.tld.conf 같은 새로운 파일을 생성하고 각각의 서브 도메인을 구글로 이동 서비스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에 대한 서버 블록에 그들을 쓰는 경우? –

관련 문제