【运维知识进阶篇】集群架构-HTTPS证书详解(下)

简介: 【运维知识进阶篇】集群架构-HTTPS证书详解(下)

Nginx集群实现证书

1、准备LB01(10.0.0.5、172.16.1.5)做负载均衡,Web02(10.0.0.8、172.16.1.8)、Web03(10.0.0.9、172.16.1.9)两台服务器

2、配置Web02、Web03服务器监听80端口

1. [root@Web02 ~]# cat /etc/nginx/conf.d/ssl.conf
2. server {
3.         listen 80;
4.         server_name ssl.koten.com;
5. 
6.         location / {
7.                 root /code/ssl;
8.                 index index.html;
9.         }
10. }
11. [root@Web02 ~]# systemctl restart nginx
12. 
13. [root@Web03 ~]# cat /etc/nginx/conf.d/ssl.conf
14. server {
15.         listen 80;
16.         server_name ssl.koten.com;
17. 
18.         location / {
19.                 root /code/ssl;
20.                 index index.html;
21.         }
22. }
23. [root@Web03 ~]# systemctl restart nginx

3、拷贝证书到LB服务器

1. [root@LB01 ~]# scp -rp 172.16.1.7:/etc/nginx/ssl_key /etc/nginx/
2. The authenticity of host '172.16.1.7 (172.16.1.7)' can't be established.
3. ECDSA key fingerprint is SHA256:zQvI/tCFYssR7l6cr90EtaIA93FXJp8FmUhGtkZshlA.
4. ECDSA key fingerprint is MD5:0b:a1:ee:d2:75:92:1a:62:05:63:5e:d1:e8:42:13:84.
5. Are you sure you want to continue connecting (yes/no)? yes
6. Warning: Permanently added '172.16.1.7' (ECDSA) to the list of known hosts.
7. root@172.16.1.7's password: 
8. server.key       100% 1704   906.5KB/s   00:00    
9. server.crt       100% 1411     1.0MB/s   00:00

4、配置LB01的Nginx配置文件

1. [root@LB01 ~]# cat /etc/nginx/conf.d/proxy_ssl.conf 
2. upstream website {
3.         server 172.16.1.8:80;
4.         server 172.16.1.9:80;
5. }
6. 
7. server {
8.         listen 443 ssl;
9.         server_name ssl.koten.com;
10.         ssl_certificate   ssl_key/server.crt;
11.         ssl_certificate_key  ssl_key/server.key;
12.         location / {
13.             proxy_pass http://website;
14.             proxy_set_header Host $http_host;
15.         }
16. }
17. 
18. server {
19.         listen 80;
20.         server_name ssl.koten.com;
21. return 302 https://$server_name$request_uri;
22. }
23. [root@LB01 ~]# systemctl restart nginx

5、浏览器访问

 

真实业务实现HTTPS证书

1、配置LB01中的wordpress和wecenter的配置

1. [root@LB01 ~]# cat /etc/nginx/conf.d/proxy_ssl.conf 
2. upstream webs {
3.         server 172.16.1.7:80;
4.         server 172.16.1.8:80;
5. }
6. 
7. #用户的http请求跳转至https
8. server {
9.         listen 80;
10.         server_name blog.koten.com;
11. return 302 https://$server_name$request_uri;
12. }
13. 
14. server {
15.         listen 80;
16.         server_name wecenter.koten.com;
17. return 302 https://$server_name$request_uri;
18. }   
19. 
20. server {
21.         listen 443 ssl;
22.         server_name blog.koten.com;
23.         ssl_certificate   ssl_key/server.crt;
24.         ssl_certificate_key  ssl_key/server.key;
25.         location / {
26.                 proxy_pass http://webs;
27.                 include proxy_params;
28.         }
29. }
30. 
31. server {
32.         listen 443 ssl;
33.         server_name wecenter.koten.com;
34.         ssl_certificate   ssl_key/server.crt;
35.         ssl_certificate_key  ssl_key/server.key;
36.         location / {
37.                 proxy_pass http://webs;
38.                 include proxy_params;
39.         }       
40. }
41. [root@LB01 ~]# nginx -t
42. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
43. nginx: configuration file /etc/nginx/nginx.conf test is successful
44. [root@LB01 ~]# nginx -s reload

2、浏览器访问

发现均出现排版错误的情况,这是因为PHP对https不适配。

3、修正排版问题

需要在Web01和Web02的Wecenter和WordPress配置文件里添加如下配置,并重启Nginx

1. #告诉PHP我前置的负载使用的是https协议                
2. fastcgi_param HTTPS on;

例如Web01的WordPress配置文件

1. [root@Web01 wecenter]# cat /etc/nginx/conf.d/wordpress.conf 
2. server {
3.  listen 80;
4.  server_name blog.koten.com;
5.  root /code/wordpress;
6.  index index.php index.html index.htm;
7. 
8.  location ~\.php$ {
9.    root /code/wordpress;
10.     fastcgi_pass 127.0.0.1:9000;
11.     fastcgi_index index.php;
12.     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
13.         fastcgi_param HTTPS on;
14.     include fastcgi_params;
15.   }
16. }
17. [root@Web01 wecenter]#

4、再次访问发现恢复

5、phpmyadmin配置文件与问题

1. [root@LB01 ~]# cat /etc/nginx/conf.d/proxy_php.conf 
2. upstream web {
3.         server 172.16.1.7:80;
4.         server 172.16.1.8:80;
5. }
6. 
7. server {
8.         listen 80;
9.         server_name php.koten.com;
10. return 302 https://$server_name$request_uri;
11. }
12. 
13. server {
14.         listen 443 ssl;
15.         ssl_certificate   ssl_key/server.crt;
16.         ssl_certificate_key  ssl_key/server.key;
17.         server_name php.koten.com;
18.         location / {
19.             proxy_pass http://web;
20.             include proxy_params;
21.         }
22. }
23. [root@LB01 ~]# systemctl restart nginx

6、解决phpmyadmin问题

在Web01和Web02的phpmyadmin配置文件上增加如下配置:

fastcgi_param HTTPS on;

恢复正常!

目录
相关文章
|
2天前
|
安全 算法 网络协议
解析:HTTPS通过SSL/TLS证书加密的原理与逻辑
HTTPS通过SSL/TLS证书加密,结合对称与非对称加密及数字证书验证实现安全通信。首先,服务器发送含公钥的数字证书,客户端验证其合法性后生成随机数并用公钥加密发送给服务器,双方据此生成相同的对称密钥。后续通信使用对称加密确保高效性和安全性。同时,数字证书验证服务器身份,防止中间人攻击;哈希算法和数字签名确保数据完整性,防止篡改。整个流程保障了身份认证、数据加密和完整性保护。
|
1月前
|
监控 运维
HTTPS 证书自动化运维:https证书管理系统- 自动化监控
本文介绍如何设置和查看域名或证书监控。步骤1:根据证书状态选择新增域名或证书监控,线上部署推荐域名监控,未部署选择证书监控。步骤2:查询监控记录详情。步骤3:在详情页查看每日定时检测结果或手动测试。
HTTPS 证书自动化运维:https证书管理系统- 自动化监控
|
1月前
|
Linux 持续交付 调度
HTTPS 证书自动化运维:https证书管理系统-自动化部署
本指南介绍如何部署Linux服务器节点。首先复制生成的Linux脚本命令,然后将其粘贴到目标服务器上运行。接着刷新页面查看节点记录,并点击“配置证书”选择证书以自动部署。最后,节点部署完成,后续将自动调度,无需人工干预。
HTTPS 证书自动化运维:https证书管理系统-自动化部署
|
1月前
|
运维
HTTPS 证书自动化运维:https证书管理系统之自动化签发
通过访问【https://www.lingyanspace.com】注册账户,进入证书服务菜单并新增证书。填写域名(单域名、多域名或泛域名),创建订单后添加云解析DNS记录进行质检。确认完成后可下载证书,并支持后续查看、更新和定时更新功能。证书过期前15天自动更新,需配置邮箱接收通知。
HTTPS 证书自动化运维:https证书管理系统之自动化签发
|
1月前
|
机器学习/深度学习 人工智能 运维
HTTPS 证书自动化运维:展望未来发展趋势
HTTPS证书自动化运维正朝着更智能、高效和安全的方向发展。未来系统将提升自动化程度,减少人工干预,实现自动签发、续订与部署;深度集成多云平台,提供无缝管理体验;增强高级安全功能如加密算法和威胁检测;优化用户界面,降低使用门槛;支持更多操作系统,确保跨平台一致性;引入AI/ML技术,预测需求并自动解决问题;加强标准化与互操作性,促进生态系统协作。同时,系统将持续扩展功能、优化性能、支持国际化,并注重用户反馈,为全球用户提供优质的证书管理服务。
|
1月前
|
运维 监控 数据安全/隐私保护
HTTPS 证书自动化运维:HTTPS 证书管理系统之使用指南
本文详细介绍【灵燕空间HTTPS证书管理系统】(https://www.lingyanspace.com)的配置与使用,涵盖注册账户、邮箱配置及证书自动签发、监控和部署的一体化指南。通过页面顶部菜单的【视频教程】和【图文教程】,帮助用户从注册到实际应用全面掌握系统操作。最新迭代后,泛域名证书已包含根域名,无需额外申请多域名证书。
|
1月前
|
运维 监控 安全
HTTPS 证书自动化运维:HTTPS 证书管理系统之优势对比
本文详细介绍了一款功能强大的HTTPS证书管理系统,涵盖自动签发、更新、实时监控、部署一体化、自定义加密算法、集中管理和邮箱通知等功能。系统通过简化配置、智能引导、快速响应和多重防护等优势,确保企业和个人用户能高效、安全地管理证书,提升网站和应用的安全性。
|
4月前
|
运维 Linux Apache
,自动化运维成为现代IT基础设施的关键部分。Puppet是一款强大的自动化运维工具
【10月更文挑战第7天】随着云计算和容器化技术的发展,自动化运维成为现代IT基础设施的关键部分。Puppet是一款强大的自动化运维工具,通过定义资源状态和关系,确保系统始终处于期望配置状态。本文介绍Puppet的基本概念、安装配置及使用示例,帮助读者快速掌握Puppet,实现高效自动化运维。
103 4
|
1月前
|
人工智能 运维 监控
AI辅助的运维流程自动化:实现智能化管理的新篇章
AI辅助的运维流程自动化:实现智能化管理的新篇章
585 22
|
1月前
|
Kubernetes Java 持续交付
小团队 CI/CD 实践:无需运维,Java Web应用的自动化部署
本文介绍如何使用GitHub Actions和阿里云Kubernetes(ACK)实现Java Web应用的自动化部署。通过CI/CD流程,开发人员无需手动处理复杂的运维任务,从而提高效率并减少错误。文中详细讲解了Docker与Kubernetes的概念,并演示了从创建Kubernetes集群、配置容器镜像服务到设置GitHub仓库Secrets及编写GitHub Actions工作流的具体步骤。最终实现了代码提交后自动构建、推送镜像并部署到Kubernetes集群的功能。整个过程不仅简化了部署流程,还确保了应用在不同环境中的稳定运行。
82 9

热门文章

最新文章