在apache服务器使用证书实现https

1、安装httpd web服务器

[root@apache-web ~]# yum install httpd -y
[root@apache-web ~]# vim /etc/httpd/conf/httpd.conf
改:95 #ServerName www.example.com:80 #指定 ServerName
为:95 ServerName 192.168.1.64:80
[root@apache-web ~]# systemctl start httpd
[root@apache-web ~]# iptables -F

2、apache-web服务器使用证书实现https

1、安装ssl模块

[root@apache-web ~]# yum install mod_ssl -y

2、配置apache加载证书文件

上传证书文件到apache-web服务器/etc/httpd/conf.d文件夹

[root@apache-web ~]# ls /etc/httpd/conf.d/server.key server.key  #查看私钥
[root@apache-web ~]# vim /etc/httpd/conf.d/ssl.conf
改:100 SSLCertificateFile /etc/pki/tls/certs/localhost.crt
为:100 SSLCertificateFile /etc/httpd/conf.d/server.crt
改:107 SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
为:107 SSLCertificateKeyFile /etc/httpd/conf.d/server.key

3、启动服务,测试https,查看端口

[root@apache-web ~]# systemctl restart httpd
Enter SSL pass phrase for xuegod64.cn:443 (RSA) : 123456 #httpd 私钥密码
[root@apache-web ~]# netstat -antup | grep 443
tcp 0 0 :::443 :::* LISTEN 5138/httpd

4、浏览器测试https效果

在apache服务器使用证书实现https

在apache服务器使用证书实现https

上一篇:PhpStorm 配置本地文件自动上传至服务器


下一篇:Hibernate(冬眠,数据持久层框架)