LInux学习笔记 --https
2017-05-16 22:29
281 查看
HTTPS
1.配置
[root@localhost ~]# yum install mod_ssl
crypto-utils -y
[root@localhost ~]# genkey www.westos.com ##调用genkey,同时为生成的文件指定唯一名称
记录生成的证书和关联的私钥的位置
继续使用对话框,并选择合适的密钥大小。(默认的2048位密钥为推荐值)
在生成随机数时比较慢,敲键盘和移动鼠标可以加速
拒绝向认证机构(CA)发送证书请求(CSR)。
拒绝加密私钥
为服务器提供合适的身份。Common Name必须与服务器的主机全名完全匹配。
[root@localhost ~]# cd /etc/pki/tls/private/
[root@localhost private]# ls
localhost.key www.westos.com.key
[root@localhost ~]# mkdir /var/www/virtual/login.westos.com/html -p
[root@localhost ~]# vim /var/www/virtual/login.westos.com/html/index.html
[root@localhost ~]# cat /var/www/virtual/login.westos.com/html/index.html
[root@localhost ~]# vim /etc/httpd/conf.d/login.conf
<Virtualhost>
ServerName "login.westos.com"
DocumentRoot "/var/www/virtual/login.westos.com/html"
CustomLog "logs/login.log" combined
SSLEngine on
##开启https功能
SSLCertificateFile /etc/pki/tls/certs/www.westos.com.crt
##证书
SSLCertifica
99b5
teKeyFile /etc/pki/tls/private/www.westos.com.key
##密钥
</Virtualhost>
<Directory>
Require all granted
##网页重写实现自动访问https
</Directory>
<Virtualhost>
ServerName "login.westos.com"
RewriteEngine on
RewriteRule ^(/.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</Virtualhost>
## ^(/.*)$ https://%{HTTP_HOST}$1 [redirect=301]
## ^(/.*)$ 客户主机在地址栏中写入的所有字符
## https:// 定向成为的访问协议
## %{HTTP_HOST} 客户请求主机
## $1 $1的值就表示^(/.*)$的值
## [redirect=301] 临时重定向 302为永久重定向
[root@localhost ~]# systemctl restart httpd
【浏览器所在主机】
[root@foundation66 ~]# vim /etc/hosts
172.25.254.129 login.westos.com
2.测试
浏览器访问 https://login.westos.com 会自动跳转到 http://login.westos.com 实现网页数据加密传输
1.配置
[root@localhost ~]# yum install mod_ssl
crypto-utils -y
[root@localhost ~]# genkey www.westos.com ##调用genkey,同时为生成的文件指定唯一名称
记录生成的证书和关联的私钥的位置
继续使用对话框,并选择合适的密钥大小。(默认的2048位密钥为推荐值)
在生成随机数时比较慢,敲键盘和移动鼠标可以加速
拒绝向认证机构(CA)发送证书请求(CSR)。
拒绝加密私钥
为服务器提供合适的身份。Common Name必须与服务器的主机全名完全匹配。
[root@localhost ~]# cd /etc/pki/tls/private/
[root@localhost private]# ls
localhost.key www.westos.com.key
[root@localhost ~]# mkdir /var/www/virtual/login.westos.com/html -p
[root@localhost ~]# vim /var/www/virtual/login.westos.com/html/index.html
[root@localhost ~]# cat /var/www/virtual/login.westos.com/html/index.html
[root@localhost ~]# vim /etc/httpd/conf.d/login.conf
<Virtualhost>
ServerName "login.westos.com"
DocumentRoot "/var/www/virtual/login.westos.com/html"
CustomLog "logs/login.log" combined
SSLEngine on
##开启https功能
SSLCertificateFile /etc/pki/tls/certs/www.westos.com.crt
##证书
SSLCertifica
99b5
teKeyFile /etc/pki/tls/private/www.westos.com.key
##密钥
</Virtualhost>
<Directory>
Require all granted
##网页重写实现自动访问https
</Directory>
<Virtualhost>
ServerName "login.westos.com"
RewriteEngine on
RewriteRule ^(/.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</Virtualhost>
## ^(/.*)$ https://%{HTTP_HOST}$1 [redirect=301]
## ^(/.*)$ 客户主机在地址栏中写入的所有字符
## https:// 定向成为的访问协议
## %{HTTP_HOST} 客户请求主机
## $1 $1的值就表示^(/.*)$的值
## [redirect=301] 临时重定向 302为永久重定向
[root@localhost ~]# systemctl restart httpd
【浏览器所在主机】
[root@foundation66 ~]# vim /etc/hosts
172.25.254.129 login.westos.com
2.测试
浏览器访问 https://login.westos.com 会自动跳转到 http://login.westos.com 实现网页数据加密传输
相关文章推荐
- Linux学习笔记-与系统管理有关的命令[转帖]
- LINUX学习笔记—SAMBA使用篇 smb 文件共享
- linux学习笔记
- 转载:写得蛮好的linux学习笔记
- Linux学习笔记
- Openldap for Linux 学习笔记 [原文http://www.ringkee.com/jims/technic_folder/Openldap]
- 写得蛮好的linux学习笔记(压缩命令,vi一般用法,认识SHELL,正规表示法)
- rh9 linux服务配置学习笔记---------Apache
- Linux下汇编学习笔记之三--(Professional Assembly Language)
- 写得蛮好的linux学习笔记(linux目录架构)
- Linux学习笔记之后台进程(at和&)
- linux 学习笔记 - php 环境安装与配置
- Linux 学习笔记( LINUX运行的硬件基础1)
- rh9 linux服务配置学习笔记--------dns
- linux学习笔记
- 学习笔记-Linux 系统管理学习笔记(一)
- Linux基础知识学习笔记(一)--文件系统的权限管理
- 学习嵌入式Linux系统的笔记和体会
- 整理下最近LINUX学习笔记
- 写得蛮好的linux学习笔记(一些常用的基本命令)