📝

synology ddns, ssl 고민

목표 : 보안인증서 적용 (ssl, https) 서브도메인 헤놀로지 : https://bbb.aaa.com으로 접속 역방향 proxy 필요 현재 진행 사항 서브 도메인 : https://bbb.aaa.com:port까지 성공 인증서 미해결 https://bbb.aaa.com 으

SDK · · 1,946 자

목표 :

  1. 보안인증서 적용 (ssl, https)
  2. 서브도메인 헤놀로지 :  https://bbb.aaa.com으로 접속
역방향 proxy 필요   현재 진행 사항 서브 도메인 : https://bbb.aaa.com:port까지 성공 인증서 미해결 https://bbb.aaa.com 으로 연결하는 것이 목표

현재상황

리버스 프록시 (reverrse proxy) 가 필요한 상황 현재 가상호스트 사용하고 있으나 개념 확실히 모름.
https://www.joinc.co.kr/w/man/12/proxy http://akal.co.kr/?p=1173
위 블로그에서 리버스프록시 개념 알게됨 1. 현재 웹서버(nginx) 개방포트 80, 443, 22등 많이 사용하고 있음
  1. nginx 가상호스트로  도메인:80으로 여러 도메인 사용중

  2. 헤놀로지는 다른 서버 ip다름 공유기의 80,22, 443등 포트 웹서버가 잡고 있음

  3. 그래서 방안 필요 :  리버스 프록시

nginx 설정에서 뭔가가 필요 현재 문제점 https://bbb.aaa.com:port : 헤놀로지 정상 진입 https://bbb.aaa.com :  운영중인 도메인 중 한개로 진입 nginx  /etc/nginx/conf.d/default.conf 에서 무언가 조치 필요. -> 헤놀로지 내부 아이피:port로 바로 보내주면 될 것 같은 느낌.

진행사항 1. 헤놀로지 ddns dnszi.com 시놀로지 : 스케줄링 weget:   2018.06.24  update :  시놀로지에서 DDNS 안함. 프록시 서버 ( ubuntu) 에서 해결
  1. 유저생성
$adduser nas
  2. 인증서 발급
$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /root/ssl/localhost.key -out /root/ssl/localhost.crt
  1. /etc/nginx/conf.d/default.ssl.conf
server {
    listen       443 default_server;
    server_name  localhost;
 
    ssl_certificate "/root/ssl/localhost.crt";
    ssl_certificate_key "/root/ssl/localhost.key";
 
    ssl_ciphers 'PSK';
 
    return 444;
}
 
  1. bbb.aaa.com.conf(nginx) - synology (xpenology)
  server {
            listen 80;
            server_name bbb.aaa.com;

           return 301 https://server_name;
}

server {

        listen 443 ssl http2;
        server_name bbb.aaa.com;

        location / {
        proxy_redirect off;
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_pass http://000.000.000.000/;
       }
     
  1. let`s 인증서
실패 : 리버스 프록시가 구성되어야 443, 80이 헤놀로지에 연결되어 시도할수 있을것 같음. 헤놀로지에서는 하지 않고 프록시서버에서 받아야 할것 같음.
letsencrypt certonly --webroot --webroot-path=/home/bbb/www -d bbb.aaa.com
  1. https://aaa.com 웹서버 https://bbb.aaa.com:5555 시놀로지 revers proxy

  2. 버추어 호스트 (가상 호스트)

nginx /etc/nginx/conf.d/default.conf 수정 현재 https://bbb.aaa.com 으로 접속하면 https://bbb.aaa.com:port로 변경되어 접속까지 성공 // TODO : 1 . SSL 2. bbb.aaa.com:port 에서 :port 제거   TO BE 컨티뉴....