博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
配置apache对 https 的支持
阅读量:3559 次
发布时间:2019-05-20

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

一、 安装准备

1. 安装Openssl

要使Apache支持SSL,需要首先安装Openssl支持。这里使用的是openssl-0.9.8k.tar.gz

Openssl:http://www.openssl.org/source/

tar -zxf openssl-0.9.8k.tar.gz //解压安装包

cd openssl-0.9.8k //进入已经解压的安装包

./config //配置安装。推荐使用默认配置

make && make install //编译及安装

openssl默认将被安装到/usr/local/ssl


2. 安装Apache

从http://httpd.apache.org/下载httpd源代码,这里使用的是httpd2.2.22;

./configure --prefix=/usr/local/httpd2.2.22 --enable-so --enable-ssl --with-ssl=/usr/local/ssl --enable-mods-shared=all //配置安装。推荐动态编译模块
make && make install
动态编译Apache模块,便于模块的加载管理。Apache 将被安装到/usr/local/apache
二、 生成证书

为了快速搭建好可用的https服务器,需要在/usr/local/httpd2.2.22/conf/目录下

(也可以在别的目录下生成,将生成后的文件拷贝到/usr/local/httpd2.2.22/conf/目录下)

依次运行以下命令:

1. openssl req -new -text -out server.req

2. openssl rsa -in privkey.pem -out server.key

3. openssl req -x509 -in server.req -text -key server.key -out server.crt

具体的可以参考openssl文档;

三、 Apache 的配置

打开apache安装目录下conf目录中的httpd.conf文件,找到

#LoadModule ssl_module modules/mod_ssl.so
删除行首的配置语句注释符号“#”
保存退出。
打开apache安装目录下conf目录中的ssl.conf文件,找到
在配置文件中查找以下配置语句
SSLCertificateFile conf/ssl.crt/server.crt 将服务器证书配置到该路径下
SSLCertificateKeyFile conf/ssl.key/server.key 将服务器证书私钥配置到该路径下
#SSLCertificateChainFile conf/ssl.crt/ca.crt 删除行首的“#”号注释符,并将中级CA证书intermediate.crt配置到该路径下
保存退出,并重启Apache。重启方式:
进入Apache安装目录下的bin目录,运行如下命令
./apachectl -k -stop
./apachectl start
通过https方式访问您的站点,测试站点证书的安装配置。

此时即可以通过http和https访问搭建好的服务器;

转载地址:http://pfnrj.baihongyu.com/

你可能感兴趣的文章
mybatis的mapper.xml文件中含有中文注释时运行出错,mybatis配置优化和别名优化 mybatis配置之映射器说明
查看>>
Uncaught (in promise) Error: Request failed with status code 500
查看>>
【错误记录】Error creating bean with name: Unsatisfied dependency expressed through field
查看>>
【笔记】opencv阈值处理 threshold函数 cv2.THRESH_BINARY ,cv2.THRESH_TRUNC) cv2.adaptiveThreshold()
查看>>
pip安装pandas失败Could not find a version that satisfies the requirement pandas
查看>>
【问题记录】pytorch自定义数据集 No such file or directory, invalid index of a 0-dim
查看>>
【笔记】spring的注解回顾,springboot-restful项目结构介绍 springboot-freemarker ⼯程配置详解
查看>>
ubuntu上训练yolov3: Caught ValueError in DataLoader worker process 0. string indices must be integers.
查看>>
在集群服务器进行自定义数据集训练记录过程 TensorBoard logging requires TensorBoard with Python summary writer installed.
查看>>
【问题记录】raise IndexError(‘index {} is out of range‘.format(idx)) index 0 is out of range
查看>>
【问题记录】filters = int(module_def[‘filters‘]) ValueError: invalid literal for int() with base 10: ‘‘
查看>>
Document.visibilityState 页面监听 vue中实现离开页面时计时停止: 停止计时后从上一次开始计时
查看>>
【项目实战】vue-springboot-pytorch前后端结合pytorch深度学习 html打开本地摄像头 监控人脸和记录时间
查看>>
vue-springboot项目 mybatis条件查询结果为null时解决方案 @Param @RequestParam 的参数传递
查看>>
【问题记录】解决npm 报错This dependency was not found: A complete log of this run can be found in:
查看>>
【ubuntu】ubuntu18.04:在处理时有错误发生:ufw E: Sub-process /usr/bin/dpkg returned an error code (1)
查看>>
【问题记录】服务器部署项目时启动tomcat后报错 HTTP 错误 404.0- Not Found 您要找的资源已被删除、已更名或暂时不可用 解决方案···
查看>>
【算法练习】 天平( UVa 839) 输入一个树状天平,根据力矩相等原则判断是否平衡 和 小球下落(UVa 679)判断最后一个小球会落到哪里
查看>>
【算法学习笔记】图(三)利用广度优先搜索 求不带权无向图从顶点u到v的最短路径/求距离u最远的顶点
查看>>
【算法学习笔记】 图(四)用优先级队列优化Dijkstra算法求最短路径(邻接矩阵存储)
查看>>