Apache搭建HTTPS Virtual Host

简介:
Apache 搭建HTTPS Virtual Host
  1.创建SSL证书
  首先需要安装openssl,linux系统默认已安装,如没有则用以下命令安装:
  sudo apt-get install openssl
  sudo apt-get install libssl-dev
  创建证书:
  cd /etc/ssl/private
  sudo openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 -nodes -keyout demo.key -out demo.crt
  参数说明:
  -x509 显示证书和签名工具
  -days 证书的有效期
  -sha1 证书加密算法
  -newkey rsa:1024 创建一个新key,1024表示公钥长度为1024bits
  命令执行完会创建demo.key与demo.crt
  更多参数说明可以参考:http://www.openssl.org/docs/apps/openssl.html
  创建步骤:
root@ubuntu:/etc/ssl/private# sudo openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 -nodes -keyout demo.key -out demo.crt
Generating a 1024 bit RSA private key
.......++++++
...........++++++
writing new private key to 'demo.key'
-----
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) [AU]:CN
State or Province Name (full name) [Some-State]:GD
Locality Name (eg, city) []:GZ
Organization Name (eg, company) [Internet Widgits Pty Ltd]:fdipzone.Ltd
Organizational Unit Name (eg, section) []:test
Common Name (eg, YOUR name) []:demo.fdipzone.com
Email Address []:fdipzone@gmail.com
root@ubuntu:/etc/ssl/private#
  需要填写的项目:
Country Name (2 letter code) [AU]: 国家
State or Province Name (full name) [Some-State]:省份
Locality Name (eg, city) []:城市
Organization Name (eg, company) [Internet Widgits Pty Ltd]:公司名称
Organizational Unit Name (eg, section) []: 组织单位名称
Common Name (eg, YOUR name) []: 填写域名
Email Address []:电邮地址
  2.创建Virtual Host
<VirtualHost *:443>
DocumentRoot /home/fdipzone/demo
ServerName demo.fdipzone.com
<Directory "/home/fdipzone/demo">
allow from all
AllowOverride all
Options -Indexes FollowSymLinks
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/private/demo.crt
SSLCertificateKeyFile /etc/ssl/private/demo.key
SSLCipherSuite AES128-SHA:HIGH:MEDIUM:!aNULL:!MD5
SSLHonorCipherOrder on
</VirtualHost>
  开启SSL Engine及设置使用的证书,端口443
  SSLEngine on
  SSLCertificateFile /etc/ssl/private/demo.crt
  SSLCertificateKeyFile /etc/ssl/private/demo.key


最新内容请见作者的GitHub页:http://qaseven.github.io/

相关文章
|
10月前
|
XML 安全 应用服务中间件
Linux上面配置Apache2支持Https(ssl)具体方案实现
虽然Nginx比较流行,但是由于一些老项目用到了Apache2来支持Web服务,最近想给服务上一个Https支持,虽然看似教程简单,但是也遇到一些特殊情况,经历了一番折腾也算是解决了所有问题,将过程记录如下。演示是基于Ubantu系统。
317 0
|
3月前
|
前端开发 应用服务中间件 网络安全
在Apache上http强制跳转到https无效的解决办法
在Apache上http强制跳转到https无效的解决办法
|
7月前
|
安全 搜索推荐 网络安全
如何在Apache和Resin环境中实现HTTP到HTTPS的自动跳转:一次全面的探讨与实践
如何在Apache和Resin环境中实现HTTP到HTTPS的自动跳转:一次全面的探讨与实践
81 0
|
10月前
|
网络安全 Apache Windows
WAMPSERVER 3.0.17集成环境配置SSL进行HTTPS访问apache无法启动遇见的坑
WAMPSERVER 3.0.17集成环境配置SSL进行HTTPS访问apache无法启动遇见的坑
121 0
|
12月前
|
Apache
Apache 禁用IP 访问 和 HTTP 跳转 HTTPS
Apache 禁用IP 访问 和 HTTP 跳转 HTTPS
116 0
|
12月前
|
应用服务中间件 Apache
轻量应用服务器如何通过修改apache配置文件实现非https的访问多域名到不同子目录程序?
轻量应用服务器如何通过修改apache配置文件实现非https的访问多域名到不同子目录程序?
110 0
|
Linux 网络安全 Apache
CentOS7 Apache安装配置SSL证书/https(腾讯云为例)
CentOS7 Apache安装配置SSL证书/https(腾讯云为例)
805 0
CentOS7 Apache安装配置SSL证书/https(腾讯云为例)
|
网络协议 小程序 关系型数据库
centos配置apache的https服务证书安装
centos配置apache的https服务证书安装
391 0
centos配置apache的https服务证书安装
|
安全 网络协议 算法
RH358配置Web服务器--使用 Apache HTTPD 配置 HTTPS
RH358配置Web服务器--使用 Apache HTTPD 配置 HTTPS
214 0
RH358配置Web服务器--使用 Apache HTTPD 配置 HTTPS
|
网络安全 Apache 数据安全/隐私保护
phpstudy集成下Apache配置SSL证书实现https加密访问
phpstudy集成下Apache配置SSL证书实现https加密访问

推荐镜像

更多