首页
文章
代码笔记
资源分享
生活随笔
AI相册
工具箱
归档
友链
关于
微信公众号
欢迎关注,一起学习!
搜索
搜索内容
×
文章详情
Nginx安装SSL安全证书
Nginx
SSL
1. 在Nginx的安装目录下的config目录下创建cert目录,并且将下载的证书全部文件拷贝到cert目录中。如果申请证书时是自己创建的CSR文件,请将对应的私钥文件放到cert目录下并且命名为20180907.key; 2. 打开 Nginx 安装目录下 conf 目录中的 nginx.conf 文件,找到:HTTPS server配置项,粘贴以下配置 ``` server { listen 443 ssl; #删掉 ssl on; 配置项 ssl写在443端口后面 server_name www.***.com; #你的域名 root html; #你的网站根目录 index index.php index.html index.htm; #网站默认访问文件 ssl_certificate cert\20180907.pem; #证书文件 ssl_certificate_key cert\20180907.key; #秘钥文件 ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { root html; #网站根目录 index index.php index.html index.htm; #网站默认访问文件 } location ~ \.php(.*)$ { #PHP必须的配置,否则浏览器访问会直接下载php源码文件 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } } ``` 3. 重启Nginx服务器 4. 使用https域名访问网站
评论 (${comments_count})
评论
Loading...
${item.comment_time}
${item.nickname}
${c1_item.comment_time}
${c1_item.nickname}
${c1_item.reply_nickname}
${c1_item.content}
${comment_header_label}
×
邮件提醒
有回复时邮件通知我
${comment_header_label}