Ubuntu下 利用httpd和OpenSSL搭建HTTPS web服务器
来源:互联网 发布:软件项目评审表模板 编辑:程序博客网 时间:2024/05/17 06:39
httpd安装见我的另一篇博客 :
http://blog.csdn.net/rock4you/article/details/53115854
以下所有操作,建议全程在root权限下执行。
一、安装OpenSSL
1.下载OpenSSL。当前版本为openssl-1.0.2j.tar.gz
https://www.openssl.org/
2.解压。
tar zxvf openssl-1.0.2j.tar.gz
3.进入解压后的目录,安装。
./config shared --prefix=/usr/local/opensslmakemake testmake install
二、给服务器颁发证书
1.创建CA签名(不需要加密的话可以去掉 -des3 选项)
openssl genrsa -des3 -out server.key 1024
2.创建CSR
openssl req -new -key server.key -out server.csr
3.签发证书
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
4.将证书和密钥复制到相应目录
cp server.crt /etc/ssl/certscp server.key /etc/ssl/private
5.修改配置文件
cp /etc/apache2/sites-enabled/000-default.conf /etc/apache2/sites-enabled/001-ssl.confsudo gedit 001-ssl.conf
进入001-ssl.conf后,
将<VirtualHost *:80>中的80修改为443
在DocumentRoot下面加入以下内容:
SSLEngine OnSSLOptions +StrictRequireSSLCertificateFile /etc/ssl/certs/server.crtSSLCertificateKeyFile /etc/ssl/private/server.key
6.加载新的配置并重启apache
/etc/init.d/apache2 force-reload/etc/init.d/apache2 restart
7.使用浏览器测试 https://localhost/
我是在虚拟机中运行的Ubuntu,本地测试截图:
在Windows中用Chrome访问虚拟机服务器,可以查看到证书,截图:
0 0
- Ubuntu下 利用httpd和OpenSSL搭建HTTPS web服务器
- wampserver 使用openssl和apache搭建https服务器教程
- ubuntu下搭建web服务器
- Ubuntu下搭建Web服务器
- Ubuntu下搭建web服务器
- Ubuntu下搭建web服务器
- 利用openssl生成的https的ca来访问web服务器
- Tiny HTTPd 开源web服务器搭建过程
- Ubuntu 11.10下搭建Web服务器
- ubuntu下web服务器的搭建
- Ubuntu 11.10下搭建Web服务器
- Ubuntu 12.04下搭建Web服务器
- Ubuntu 12.04下搭建Web服务器
- Ubuntu 12.04下搭建Web服务器
- Ubuntu 11.0下搭建Web服务器
- Ubuntu下Web服务器的搭建
- Ubuntu 14.04下搭建Web服务器
- win7下Ubuntu Desktop 搭建web服务器
- 基于distanceTransform-距离变换的手掌中心提取
- 《构建高质量的C#代码》学习笔记
- Map中entrySet()和keySet()比较
- 榆木脑袋
- 初探接口测试框架--python系列1
- Ubuntu下 利用httpd和OpenSSL搭建HTTPS web服务器
- peda 官方帮助文档
- android app出现红叉怎么解决
- oracle单行函数
- 嵌入式新手须知
- 图像缩放--双线性内插法
- c#第三章课后作业3
- angualr使用技巧
- RxJava之入门详解