2016-08-11 4 views
0

하나의 노드 응용 프로그램과 하나의 정적 페이지 (단지 html)를 동시에 두 개의 별도 도메인에서 실행하는 데 문제가 있습니다. 아무리 정적 도메인은 항상 여기에Nginx | 2 개의 도메인 (1x 노드 응용 프로그램, 1x 정적 HTML) 하나의 서버에

(포트 3000) 노드 응용 프로그램으로 리디렉션됩니다하려고 무엇을 "사이트-가능"파일이 없습니다 :

노드 응용 프로그램 :

server { 
    listen [::]:80; 
    listen 80; 


server_name www.domain1.com domain1.com; 

# and redirect to the https host (declared below) 
return 301 https://domain1.com$request_uri; 
} 

server { 
    listen 443; 
    server_name domain1.com www.domain1.com; 

    ssl on; 
    # Use certificate and key provided by Let's Encrypt: 
    ssl_certificate /etc/letsencrypt/live/domain1.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/domain1.com/privkey.pem; 
    ssl_session_timeout 5m; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; 


    location/{ 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header Host $http_host; 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
      proxy_set_header X-NginX-Proxy true; 
      proxy_pass http://localhost:3000/; 
      proxy_ssl_session_reuse off; 
      proxy_set_header Host $http_host; 
      proxy_cache_bypass $http_upgrade; 
      proxy_redirect off; 
    } 
} 

그리고 정적 하나 :

server { 
    listen [::]:80; 
    listen 80; 


    #server_name www.domain2.com domain2.com; 

    root /var/www/html/domain2; 
    index index.html index.htm; 


    return 301 https://domain2.com$request_uri; 
} 

server { 

    listen [::]:443 ssl; 
    listen 443 ssl; 

    root /var/www/html/domain2; 

    index index.html index.htm; 

    ssl_certificate /etc/letsencrypt/live/domain2.com/fullchain.pem; 
    ssl_certificate_key /etc/letsencrypt/live/domain2.com/privkey.pem; 
} 

기본 구성 파일은 비어 있습니다. 어떤 도움/힌트도 크게 감사 할 것입니다.

domain2에 대한 인증서를 암호화하고, 두 도메인을 각각 별도의 구성으로 만들고 기본값을 제거 할 때까지 정상적으로 작동했습니다.

미리 감사드립니다.

+0

당신이'사이트 - enabled'에 심볼릭 링크를 설치 한 적이 있습니까? –

+0

안녕 리차드, 의견을 주셔서 감사합니다. 네, 심볼릭 링크가 설치되어 있습니다. – Klapperstorch

답변