阿里云配置ssl证书
一、申请证书和下载证书(阿里云申请)
二、在nginx服务器上配置ssl证书
1.检查服务器是否安装openssl
2.在nginx conf 文件夹创建 cret 文件,放置证书
[root@web conf]# mkdir cert
3.在需要的域名vhost主机下面配置ssl
[root@web vhost]# vi 80.conf

1 server { 2 listen 80; 3 server_name app.test.com; 4 5 location / { 6 root $root_path; 7 index index.html index.htm index.php; 8 if (!-e $request_filename) { 9 # rewrite ^(.*)$ /index.php?s=/$1 last; 10 rewrite ^/index.php(.*)$ /index.php?s=$1 last; 11 rewrite ^(.*)$ /index.php?s=$1 last; 12 13 } 14 } 15 error_page 500 502 503 504 /50x.html; 16 location = /50x.html { 17 root $root_path; 18 } 19 20 location ~ \.php$ { 21 root $root_path; 22 #fastcgi_pass 127.0.0.1:9000; 23 fastcgi_pass unix:/tmp/php-cgi.sock; 24 fastcgi_index index.php; 25 include fastcgi.conf; 26 } 27 } 28 server { 29 listen 443; 30 server_name app.test.com; 31 ssl on; 32 ssl_certificate /usr/local/nginx/conf/cert/21485836dsfdsf0846.pem; 33 ssl_certificate_key /usr/local/nginx/conf/cert/214sdfdfds0846.key; 34 ssl_session_timeout 5m; 35 sl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; 36 ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 37 ssl_prefer_server_ciphers on; 38 location / { 39 root $root_path; 40 index index.html index.htm index.php; 41 if (!-e $request_filename) { 42 # rewrite ^(.*)$ /index.php?s=/$1 last; 43 rewrite ^/index.php(.*)$ /index.php?s=$1 last; 44 rewrite ^(.*)$ /index.php?s=$1 last; 45 46 } 47 } 48 error_page 500 502 503 504 /50x.html; 49 location = /50x.html { 50 root $root_path; 51 } 52 53 location ~ \.php$ { 54 root $root_path; 55 #fastcgi_pass 127.0.0.1:9000; 56 fastcgi_pass unix:/tmp/php-cgi.sock; 57 fastcgi_index index.php; 58 include fastcgi.conf; 59 } 60 61 }
4.检查nginx 配置文件
5.重启nginx
nginx -s reload
三、效果
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构