免费爱碰视频在线观看,九九精品国产屋,欧美亚洲尤物久久精品,1024在线观看视频亚洲

      Nginx 自簽https 證書(反向代理)

      以下操作在centos 下執(zhí)行:

      cd/opt/ssl 證書制作路徑

      1)openssl genrsa -des3 -out domain.key 1024

      生成RSA密鑰(過程需要設(shè)置一個密碼,記住這個密碼)

      2)openssl rsa -in domain.key -out domain_nopass.key

      拷貝一個不需要輸入密碼的密鑰文件

      3)openssl req -new -key domain.key -out domain.csr

      這里會提示輸入國家,地區(qū)組織,email等信息.最重要的一個是”common name”,需要與網(wǎng)站域名相同.

      [root@localhost ssl]# openssl req -new -key domain.key -out domain.csr

      Enter pass phrase for domain.key: ####1) 密碼

      You are about to be asked to enter information that will be incorporated

      into your certificate request.

      What you are about to enter is what is called a Distinguished Name or a CN.

      There are quite a few fields but you can leave some blank

      For some fields there will be a default value,

      If you enter ‘.’, the field will be left blank.

      —–

      Country Name (2 letter code) [XX]:cn 國家

      State or Province Name (full name) []:zj 省

      Locality Name (eg, city) [Default City]:hz 城市

      Organization Name (eg, company) [Default Company Ltd]:tset 機構(gòu)名稱

      Organizational Unit Name (eg, section) []:test 單位名稱

      Common Name (eg, your name or your server’s hostname) []:domain.com 網(wǎng)站域名

      Email Address []: 郵箱 可以回車

      Please enter the following ‘extra’ attributes

      to be sent with your certificate request

      A challenge password []: 可以回車

      An optional company name []: 可以回車

      輸入完這些就會生成一個domain.csr文件,提交給ssl提供商的時候就是這個csr文件.當然這里并沒有向任何證書提供商申請,而是自己簽發(fā)證書.

      使用上面的密鑰和CSR對證書簽名$ openssl x509 -req -days 365 -in domain.csr -signkey domain.key -out domain.crt

      備注:這個365 時間可以多寫點。

      檢測nginx是否支持SSL:$ nginx -V如果有顯示-with-http_ssl_module表示已編譯openssl,支持安裝ssl.如果沒有,請重新編譯安裝nginx

      參考配置文件

      server {

      listen 80;

      listen [::]:80;

      server_name x.x.x.x; #可以寫成服務(wù)器地址

      root /usr/share/nginx/html;

      # Load configuration files for the default server block.

      include /etc/nginx/default.d/*.conf;

      error_page 404 /404.html;

      location = /404.html {

      }

      error_page 500 502 503 504 /50x.html;

      location = /50x.html {

      }

      location /status {

      stub_status on;

      access_log off;

      }

      location / {

      proxy_redirect off;

      proxy_set_header Host $host;

      proxy_set_header X-real-IP $remote_addr;

      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_pass https://domain.com; ###反向代理地址

      rewrite ^(.*)$ https://$host$1 permanent;

      }

      }

      # Settings for a TLS enabled server.

      server {

      listen 443 ssl http2;

      listen [::]:443 ssl http2;

      server_name 10.100.124.6;

      ssl_certificate “/opt/ssl/domain.pem”; ## 證書地址

      ssl_certificate_key “/opt/ssl/domain_nopass.key”; ### 證書地址

      ssl_session_cache shared:SSL:1m;

      ssl_session_timeout 10m;

      ssl_ciphers HIGH:!aNULL:!MD5;

      ssl_prefer_server_ciphers on;

      # # Load configuration files for the default server block.

      include /etc/nginx/default.d/*.conf;

      error_page 404 /404.html;

      location = /40x.html {

      }

      error_page 500 502 503 504 /50x.html;

      location = /50x.html {

      }

      location / {

      proxy_redirect off;

      proxy_set_header Host $host;

      proxy_set_header X-real-IP $remote_addr;

      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_pass https://domain.com; ## 反向代理地址,如無反向代理地址可以家#注解

      }

      }

      }

      鄭重聲明:本文內(nèi)容及圖片均整理自互聯(lián)網(wǎng),不代表本站立場,版權(quán)歸原作者所有,如有侵權(quán)請聯(lián)系管理員(admin#wlmqw.com)刪除。
      上一篇 2022年6月12日 18:14
      下一篇 2022年6月12日 18:14

      相關(guān)推薦

      聯(lián)系我們

      聯(lián)系郵箱:admin#wlmqw.com
      工作時間:周一至周五,10:30-18:30,節(jié)假日休息