Nginx配置开启HTTPS

  1. 获取证书文件

  2. Nginx 开启SSL

    server {
    listen 443 default ssl;
    server_name localhost;
    #charset koi8-r;
    #access_log logs/host.access.log main;
    proxy_set_header Host $host;

    复制代码
         ssl_certificate /usr/local/nginx/cert/server.pem;
         ssl_certificate_key /usr/local/nginx/cert/ca.key;
         ssl_session_cache   shared:SSL:128m;
         ssl_session_timeout 5m;
         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
         ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
         ssl_prefer_server_ciphers on;
         
         location / {
             root   html;
             index  index.html index.htm;
             try_files $uri /index.html;
         }
         # redirect server error pages to the static page /50x.html
         #
         error_page   500 502 503 504  /50x.html;
         location = /50x.html {
             root   html;
         }
    
     }
  3. 重启Nginx

bash 复制代码
cd ../sbin
./nginx -s reload
相关推荐
张太行_7 小时前
Linux静态库:多模块高效管理
linux·运维·服务器
2501_916008897 小时前
iOS 上架需要哪些准备,账号、Bundle ID、证书、描述文件、安装测试及上传
android·ios·小程序·https·uni-app·iphone·webview
wgl6665208 小时前
Linux---基础IO!
linux·运维·服务器
Ancelin安心8 小时前
kali-dirsearch的使用
linux·运维·服务器·python·计算机网络·web安全·网络安全
jun_bai9 小时前
python+Java的网盘程序升级版。无感知备份文档,保护数据资产利器。
运维·服务器
suzhou_speeder9 小时前
PoE 延长器:突破 PoE 距离限制,优化网络灵活部署方案
运维·网络·poe·poe交换机·poe延长器
月光下的麦克9 小时前
如何查案动态库版本
linux·运维·c++
EndingCoder10 小时前
索引类型和 keyof 操作符
linux·运维·前端·javascript·ubuntu·typescript
liux352810 小时前
Web集群管理实战指南:从架构到运维
运维·前端·架构
石小千10 小时前
Linux清除缓存
linux·运维