Nginx 설정 Https 상세 설명

2902 단어 NginxHttps웹 서버
TLS 또는 전송 계층 보안 (transport layer security) 의 전신 은 SSL (보안 소켓 층 secure sockets layer) 이 고 웹 프로 토 콜 은 보 호 받 고 암호 화 된 정상 적 인 채널 에 감 싸 는 것 입 니 다.이러한 기술 을 사용 하면 서버 와 클 라 이언 트 간 에 안전하게 상호작용 을 할 수 있 으 며 메시지 가 차단 되 고 읽 힐 까 봐 걱정 하지 않 아 도 된다.인증서 시스템 은 사용자 가 연결 사이트 와 의 신분 을 확인 하 는 데 도움 을 줍 니 다.환경 설명
Nginx*2+Keepalived+Tomcat*2 Web  
      :https://blog.51cto.com/gdutcxh/2109841

실험 환경 에서 배치
1、  openssl:yum install openssl* -y
2、  openssl      
    mkdir -p /etc/nginx/ssl
    openssl req -x509 -nodes -days 36500 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.pem

    Country Name (2 letter code) [AU]:US
    State or Province Name (full name) [Some-State]:New York
    Locality Name (eg, city) []:New York City
    Organization Name (eg, company) [Internet Widgits Pty Ltd]:Bouncy Castles, Inc.
    Organizational Unit Name (eg, section) []:Ministry of Water Slides
    Common Name (e.g. server FQDN or YOUR name) []:your_domain.com
    Email Address []:admin@your_domain.com
3、Nginx    (   Https)
    server {
        listen       80;
        server_name  www.yourdomain.com;
        rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
        #return 301 https://$http_host$request_uri;
    }

server {
        listen 443 ssl;
        ssl_certificate /etc/nginx/ssl/nginx.pem;
        ssl_certificate_key /etc/nginx/ssl/nginx.key;
        keepalive_timeout   70;
        server_name www.yourdomain.com;
       #   header        ,  ***      ***
        server_tokens off;
        #      HTTPS       HTTP   ,     HSTS               ,      HTTPS   
        #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
        # ......
        fastcgi_param   HTTPS               on;
        fastcgi_param   HTTP_SCHEME         https;

        access_log      /var/log/nginx/wiki.xby1993.net.access.log;
        error_log       /var/log/nginx/wiki.xby1993.net.error.log;
    }
4、    Http Https
Nginx   
server {
    listen              80;
    listen              443 ssl;
    server_name         www.example.com;
    ssl_certificate     www.example.com.pem;
    ssl_certificate_key www.example.com.key;
    ...
}
6、  Nginx

openssl 의 설명
req:     -x509     X.509        (certificate signing request (CSR))."X.509"        that SSL and TLS adheres to for its key and certificate management.
-nodes:   OpenSSL           .(      Nginx        ,           )。
-days 36500:      ,100 
-newkey rsa:2048:               SSL key(     RSA 2048)
-keyout:SSL     
-out:       
       。       common name       , wiki.xby1993.net          ,           *.xby1993.net                。

기업 웹 서버 의 HTTPS
 、  ,  CA  
                       ,         ,               。
 、         
      zip ,   xxx.key xxx.pem    。
 、  Nginx(  )

좋은 웹페이지 즐겨찾기