您的位置:首頁技術文章
文章詳情頁

nginx https 443端口配置的方法

瀏覽:23日期:2023-06-15 15:23:35
目錄
  • 一丶登錄阿里云或者騰訊云等域名控制器下載免費證書
  • 二丶點擊nginx下載,并且上傳到服務器
  • 三丶nginx配置https協議

一丶登錄阿里云或者騰訊云等域名控制器下載免費證書

二丶點擊nginx下載,并且上傳到服務器

三丶nginx配置https協議

   server {      listen  443 ssl;    server_name xxx.com;ssl_certificate cert/下載的pem后綴文件;ssl_certificate_key cert/下載的key后綴文件;ssl_session_timeout 120m;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;ssl_prefer_server_ciphers on; location / { proxy_pass http://轉發的路徑(跟http一致)/; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header Host $http_host; #proxy_set_header X-NginX-Proxy true;      #由于nginx的反向代理,所以需要在這里將$remote_addr賦值給某一參數,系統通過該參數獲取用戶的訪問ip,這里直接定義為:WL-Proxy-Client-IP     proxy_set_header    WL-Proxy-Client-IP $remote_addr; proxy_redirect default;        } error_page   500 502 503 504  /50x.html;location = /50x.html {    root   html;}   }

至此nginx 配置https完成,如果配置不生效請檢查下載的pem 跟key文件是否路徑正確

執行nginx重啟命令:systemctl restart nginx.service即可應用

關于nginx代理轉發可以看博客:https://www.jb51.net/article/136313.htm

關于nginxLinux安裝可參考:https://www.jb51.net/article/126825.htm

到此這篇關于nginx https 443端口配置的方法的文章就介紹到這了,更多相關nginx https 443端口配置內容請搜索以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持!

標簽: Nginx
国产综合久久一区二区三区