博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
配置apache使用https访问
阅读量:6079 次
发布时间:2019-06-20

本文共 1670 字,大约阅读时间需要 5 分钟。

  1. 准备

    yum install mod_ssl openssl
  2. 生成一个自签名证书

    cd /etc/pki/CA

    1.生成2048位的加密私钥
    openssl genrsa -out server.key 2048
    2.生成证书签名请求
    openssl req -new -key server.key -out server.csr

    You are about to be asked to enter information that will be incorporated

    into your certificate request.
    What you are about to enter is what is called a Distinguished Name or a DN.
    There are quite a few fields but you can leave some blank
    For some fields there will be a default value,
    If you enter '.', the field will be left blank.
    Country Name (2 letter code) [XX]:CN
    State or Province Name (full name) []:beijing
    Locality Name (eg, city) [Default City]:beijing
    Organization Name (eg, company) [Default Company Ltd]:test.com
    Organizational Unit Name (eg, section) []:test
    Common Name (eg, your name or your server's hostname) []:test.com
    Email Address []:test@qq.com

    Please enter the following 'extra' attributes

    to be sent with your certificate request
    A challenge password []:123456

    An optional company name []:test

    3.生成类型为X509的自签名证书(有效期36500天)
    openssl x509 -req -days 36500 -in server.csr -signkey server.key -out server.crt

3.配置Apache服务

vim /etc/httpd/conf.d/ssl.conf1.修改下面的内容SSLCertificateFile /etc/pki/CA/server.crtSSLCertificateKeyFile /etc/pki/CA/server.key2.重启Apache/etc/init.d/httpd restart

4.调整虚拟主机

cd /etc/httpd/conf.dvim test.conf添加以下内容NameVirtualHost *:443
SSLEngine onSSLCertificateFile /etc/pki/CA/server.crtSSLCertificateKeyFile /etc/pki/CA/server.key
AllowOverride AllServerAdmin email@example.comDocumentRoot /var/www/html/ServerName www.test.com

5.测试访问

1.因为域名只是一个测试的,所以需要再Windows下绑定hosts,自定绑定2.访问测试https://Ip

转载于:https://www.cnblogs.com/yuhuLin/p/7025857.html

你可能感兴趣的文章
什么叫垂直应用
查看>>
***SQL统计语句总结(运用场景:运营分析,财务分析等)
查看>>
CSS常用操作——————对齐
查看>>
python--IP代理池验证可用性
查看>>
python 获取yahoo股票数据
查看>>
zip文件格式说明
查看>>
java中的抽象类
查看>>
3D 架设场景
查看>>
ssl 协议与CA的创建
查看>>
Linux下终端的快捷键及建立打开终端的快捷键
查看>>
用PHPMailer-master.zip和GMAIL发邮件
查看>>
android之Intent的七大属性
查看>>
iframe自适应高度
查看>>
虚拟机联网问题
查看>>
mysql数据库默认区分大小写
查看>>
知识图谱实战开发案例剖析(16)-第一个智能对话机器人(附完整源码)
查看>>
MYSQL数据库主从复制(一)
查看>>
linux命令总结
查看>>
Ansible 五(inventory文件 主机清单)
查看>>
Zabbix监控Windows进程重启
查看>>