設定 SSL 加密網站

    self-signed certificate (自我簽署憑證)

    建立憑證檔

    mkdir /etc/nginx/ssl
    openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/raida13-cloudcoin-global.key -out /etc/nginx/ssl/raida13-cloudcoin-global.crt
    

    設定 Nginx

    server {
        listen       80;
    
        # SSL Configuration
        listen      443 ssl;
        ssl_certificate                 /etc/nginx/ssl/raida13-cloudcoin-global.crt;
        ssl_certificate_key        /etc/nginx/ssl/raida13-cloudcoin-global.key;
    
        server_name  raida13.cloudcoin.global;
    
        root   /var/www/public_web/raida13.cloudcoin.global;
        index index.php index.html index.htm;
        ...
    }
    

    強制使用 https

    server {
    ...
    # force https-redirects
    if ($scheme = http) {
    return 301 https://$server_name$request_uri;
    } ... }

     

    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core