2014-07-01 5 views
1

여러 SSL 서버 : 처리되지 않은 maching 요청Nginx의 기본 서버 - 나는 (느릅 나무 정적 컨텐츠를 제공과 바람둥이를위한 프록시로 사용)의 Nginx에 정의 된 3 개 서버가

하나 :

server { 
    listen 443 default_server; 
    return 444; 
} 
을 웹 응용 프로그램 A의

하나 : 웹 응용 프로그램 B에 대한

server { 
    listen 443; 

    server_name webAppA; 
    ssl on; 
    ssl_certificate /etc/nginx/ssl/webAppA/server.crt; 
    ssl_certificate_key /etc/nginx/ssl/webAppA/server.key; 

    index index.html; 
    root /var/www/webAppA/; 

    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 

    location/{ 
     try_files $uri $uri/ /index.html; 
    } 

    location /ws/ { 
     add_header Cache-Control no-cache; 
     proxy_pass  http://localhost:8080/webAppA/ws/; 
     proxy_set_header X-Real-IP $remote_addr; 
    } 
} 

하나 :

,728,826

https://server_ip/webAppA 
https://server_ip/webAppB 

그러나 기본 서버는 항상 선택 : 나는 모두와 애플리케이션에 액세스하기 위해 노력하고있어3210

. TSL SNI 지원이 활성화되어 있습니다.

/etc/hosts에 서버 이름을 추가하려고했지만 아무 것도 변경하지 않았습니다.

의견이 있으십니까?

감사는

+0

요청에 server_ip와 동일한 서버 이름이 있습니다. –

+0

감사합니다. 한 가지 해결책을 게시했습니다. –

답변

0

설립 된 솔루션 server_name은

"https://server_ip" 

하지 "wabAppA"또는 "webAppB"을 참조하기 때문에 하나 개의 서버를 만드는 것이 었습니다 많은 :)입니다.

server { 
    listen 443; 

    ssl on; 
    ssl_certificate /etc/nginx/ssl/server.crt; 
    ssl_certificate_key /etc/nginx/ssl/server.key; 

    root /var/www/; 

    location /webAppA/ { 
    try_files $uri $uri/ /webAppA/index.html; 
    } 

    location /webAppB/ { 
    try_files $uri $uri/ /webAppB/index.html; 
    } 

    location /webAppA/ws/ { 
    add_header Cache-Control no-cache; 
    proxy_pass  http://localhost:8080/webAppA/ws/; 
    proxy_set_header X-Real-IP $remote_addr; 
    } 

    location /webAppB/ws/ { 
    add_header Cache-Control no-cache; 
    proxy_pass  http://localhost:8080/webAppB/ws/; 
    proxy_set_header X-Real-IP $remote_addr; 
    } 
} 

내가 원하는 것처럼 유연하지 않지만 작동합니다.