配置apache使用https访问
准备
yum install mod_ssl openssl
生成一个自签名证书
cd /etc/pki/CA
1.生成2048位的加密私钥
openssl genrsa -out server.key 2048
2.生成证书签名请求
openssl req -new -key server.key -out server.csrYou 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.comPlease enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:123456An 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.conf
1.修改下面的内容
SSLCertificateFile /etc/pki/CA/server.crt
SSLCertificateKeyFile /etc/pki/CA/server.key
2.重启Apache
/etc/init.d/httpd restart
4.调整虚拟主机
cd /etc/httpd/conf.d
vim test.conf
添加以下内容
NameVirtualHost *:443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/pki/CA/server.crt
SSLCertificateKeyFile /etc/pki/CA/server.key
<Directory /var/www/html/>
AllowOverride All
</Directory>
ServerAdmin email@example.com
DocumentRoot /var/www/html/
ServerName www.test.com
</VirtualHost>
5.测试访问
1.因为域名只是一个测试的,所以需要再Windows下绑定hosts,自定绑定
2.访问测试
https://Ip
配置apache使用https访问的更多相关文章
- https----------如何在phpstudy环境下配置apache的https访问以及访问http自动跳转成https
1.首先在 httpd.conf里面修改几个地方 找到 #LoadModule ssl_module modules/mod_ssl.so 去掉前面的# Include conf/vhosts.con ...
- Windows下Nginx配置SSL实现Https访问(包含证书生成)
Vincent.李 Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...
- Ubuntu下配置apache开启https
一.HTTPS简述随着网络的日常,信息安全越来越重要,传统的网站都是http协议明文传输,而HTTPS协议是由SSL+HTTP协议构建的可进行加密传输.身份认证的网络协议,比http协议安全. 那ht ...
- windows下配置svn的https访问
svn是一个功能强大的代码版本管理系统,可以将服务端安装在linux.unix以及windows下.svn通常采用http方式进行代码提交与下载.由于密码采用明文传输,因此存在泄密的风险.若采用htt ...
- centos配置apache的https服务
因为公司要开发微信小程序,由于小程序比较特殊,需要https服务,所以就研究了下apache的https服务了,大致过程如下: 1.向证书机构申请https证书,会得到证书和私钥 2.安装apache ...
- linux下配置apache多站点访问-小案例
一级域名(baidu.com)也叫作顶级域名,注册一级域名是需要付费的. 而二级域名(image.baidu.com)是一级域名的延伸,所以只要购买了一级域名,二级域名是可以任意配置的. 其实(www ...
- 阿里云服务器在控制台配置网页强制https访问
最近接触到一个新的网站,网站的访问方式,是http, 因此在浏览器打开的时候老是显示不安全.因此要配置https访问. 首先,先说明服务器是在阿里云的,域名也是阿里云的. 方法一 1 首先在阿里云的c ...
- 安装配置ingress-nginx支持https访问
说明: 1.k8s版本:v1.23: 2.内网测试环境1台master,2台node节点,使用 DaemonSet+HostNetwork+nodeSelector 方式部署 ingress- ...
- center os7.2 apache+php+mysql环境配置并设置https访问
本人阿里云购买的center os7.2系统,小程序只支持https,因此需要配置https 安装apache yum -y install httpd systemctl start httpd a ...
随机推荐
- C语言版本:双链表的实现
Dlist.h #ifndef __DLIST_H__ #define __DLIST_H__ #include<cstdio> #include<malloc.h> #inc ...
- Python Pandas read_csv报错
为实现文本去重(将前面采集的数据进行两两对比删除重复),写了以下代码. #-*- coding: utf-8 -*-import pandas as pd inputfile = 'e:/data/H ...
- git学习心得(1)
这次是第一次用git这个平台,还非常不熟练,尤其是在上传代码的步骤上,有好几次都出了问题,多次询问了同学才将代码上传到平台上,git是一个分布式版本控制系统,相对于集中式的来说具有很多优点,但是中文资 ...
- java 面试 心得
16. ArrayList list = new ArrayList(20);中的list扩充几次() A 0 B 1 C 2 D 3 答案:A 解析:这里有点迷惑人,大家都 ...
- week5-Link Layer
Technology:Internets and Packets course Layer 1 : Link Introduction/The Link Layer moving from histo ...
- du 显示 前面以及或者两级的目录大小的方法
mark 一下 du -h --max-depth=
- func_get_args()在php71与php56的区别
func_get_args() 获取函数的所有参数,返回一个数组 官方:http://www.php.net/manual/en/function.func-get-args.php 但是此函数在ph ...
- python自动化之excel
import openpyxl wb=openpyxl.load_workbook(r'C:\Users\Administrator\Desktop\sl.xlsx') type(wb) wb.get ...
- spring not_support 该方法被事务方法调用时 不会加入spring事务 只是执行jdbc普通的事务
- BZOJ1492 货币兑换 CDQ分治优化DP
1492: [NOI2007]货币兑换Cash Time Limit: 5 Sec Memory Limit: 64 MB Description 小Y最近在一家金券交易所工作.该金券交易所只发行交 ...