分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Nginx配置站点https

发布时间:2023-09-06 01:53责任编辑:白小东关键词:配置http

step 1: 检查nginx的编译参数

使用nginx -V可以查看,如果编译参数中包含http_ssl_module,可以继续下一步操作,如果没有,则需要从新编译。

step 2: 申请证书

目前,阿里云等云平台可以申请一定时间的免费证书,这里大家可以自行找下,不再多说

step 3: 配置nginx.conf

server { ???listen 443; ???server_name hae.top; ???ssl on; ???ssl_certificate ?????/usr/local/nginx/key/214665654330627.pem; ???ssl_certificate_key ?/usr/local/nginx/key/214665654330627.key; ???ssl_session_timeout ?5m; ???ssl_protocols ?TLSv1 TLSv1.1 ?TLSv1.2; ???ssl_ciphers ????ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ???ssl_prefer_server_ciphers ??on; ???index index.html index.htm index.php; ???root ?/home/wwwroot/default/public; ???location / { ???????try_files $uri $uri/ /index.php$is_args$args; ???} ???location ~ [^/]\.php(/|$) { ???????# comment try_files $uri =404; to enable pathinfo ???????try_files $uri =404; ???????fastcgi_pass unix:/tmp/php-cgi.sock; ???????fastcgi_index index.php; ???????include fastcgi.conf; ???????fastcgi_param PHP_ADMIN_VALUE "open_basedir = /home/wwwroot: /temp/:/proc"; ???}}

接着使用https访问站点即可

Nginx配置站点https

原文地址:https://www.cnblogs.com/feanmy/p/nginx-https.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved