linux xampp apache 添加openSSL支持
2014-04-08 15:08
393 查看
Linux 系统 OpenSSL 证书生成
一、准备工作
cd /etc/pki/CA
mkdir private crl certs newcerts
echo '01' > serial #在demoCA目录下新建serial文件并写入01。
touch index.txt #在demoCA目录下新建index.txt的空文件
二、CA 根证书
2.1、生成CA根证书私钥
openssl genrsa -out private/cakey.pem 1024 #生成CA认证中心 RSA 私钥
2.2、生成CA根证书
openssl req -new -x509 -key private/cakey.pem -out cacert.pem
特别注意!!
国家、省、组织名一定要填写不能为空,且记住你填写的值
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) []:(httpd-ssl.conf中的ServerName 名称)
Email Address []:(邮箱)
三、SSL 服务器证书
3.1、生成服务器证书私钥
openssl genrsa -out private/server.key 1024
3.2、生成服务器证书请求文件
利已生成的服务器证书私钥,生成服务器证书请求csr文件
openssl req -new -key private/server.key -out crl/server.csr
1、国家、省要与上面CA证书一致,否则签署时必然要失败。
2、 Common Name 此时相当重要,请输入你需要SSL支持的域名,如 localhost(域名只能一个),否则浏览器提示证书错误。
3.3、签署服务器证书
cd ..
openssl ca -in CA/crl/server.csr -out CA/certs/server.crt
Apache 添加 OpenSSL 支持
一、 加载 Apache SSL 模块
编辑 httpd.conf,分别查找下面2行代码,并去掉前面的#
vim /opt/lampp/etc/httpd.conf
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
cd /opt/lampp/etc/extra
mv httpd-ssl.conf httpd-ssl.conf.bak #备份
vim httpd-ssl.conf #编辑,填入下面内容。
95行
<VirtualHost *:443>
# General setup for the virtual host
DocumentRoot "/opt/lampp/htdocs/test"
ServerName dzbdemo.cdsafe.com.cn
ServerAdmin zhoushengchao@cdsafe.com.cn
ErrorLog "/opt/lampp/logs/error_log"
TransferLog "/opt/lampp/logs/access_log"
......
119行
SSLCertificateFile "/etc/pki/CA/certs/server.crt"
......
130行
SSLCertificateKeyFile "/etc/pki/CA/private/server.key"
更新后重启服务即可
一、准备工作
cd /etc/pki/CA
mkdir private crl certs newcerts
echo '01' > serial #在demoCA目录下新建serial文件并写入01。
touch index.txt #在demoCA目录下新建index.txt的空文件
二、CA 根证书
2.1、生成CA根证书私钥
openssl genrsa -out private/cakey.pem 1024 #生成CA认证中心 RSA 私钥
2.2、生成CA根证书
openssl req -new -x509 -key private/cakey.pem -out cacert.pem
特别注意!!
国家、省、组织名一定要填写不能为空,且记住你填写的值
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) []:(httpd-ssl.conf中的ServerName 名称)
Email Address []:(邮箱)
三、SSL 服务器证书
3.1、生成服务器证书私钥
openssl genrsa -out private/server.key 1024
3.2、生成服务器证书请求文件
利已生成的服务器证书私钥,生成服务器证书请求csr文件
openssl req -new -key private/server.key -out crl/server.csr
1、国家、省要与上面CA证书一致,否则签署时必然要失败。
2、 Common Name 此时相当重要,请输入你需要SSL支持的域名,如 localhost(域名只能一个),否则浏览器提示证书错误。
3.3、签署服务器证书
cd ..
openssl ca -in CA/crl/server.csr -out CA/certs/server.crt
Apache 添加 OpenSSL 支持
一、 加载 Apache SSL 模块
编辑 httpd.conf,分别查找下面2行代码,并去掉前面的#
vim /opt/lampp/etc/httpd.conf
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
cd /opt/lampp/etc/extra
mv httpd-ssl.conf httpd-ssl.conf.bak #备份
vim httpd-ssl.conf #编辑,填入下面内容。
95行
<VirtualHost *:443>
# General setup for the virtual host
DocumentRoot "/opt/lampp/htdocs/test"
ServerName dzbdemo.cdsafe.com.cn
ServerAdmin zhoushengchao@cdsafe.com.cn
ErrorLog "/opt/lampp/logs/error_log"
TransferLog "/opt/lampp/logs/access_log"
......
119行
SSLCertificateFile "/etc/pki/CA/certs/server.crt"
......
130行
SSLCertificateKeyFile "/etc/pki/CA/private/server.key"
更新后重启服务即可
相关文章推荐
- Linux-CentOS XAMPP Apache 支持mp4与flv拖动播放的功能模块
- Windows下编译OpenSSL(添加Zlib支持)
- arm-linux 移植openssl wget支持https
- Linux下安装redmine,及apache的支持
- Linux下通过apxs命令给Apache添加模块
- linux-3.4.6内核添加yaffs2文件系统支持后编译出错
- linux Apache支持asp配置
- openssl命令生成公私钥、证书方法,apache/tomcat支持https的证书配置
- Linux 安装MySQL+apache+openssl+php
- Linux服务器设置Apache支持HTTPS
- Linux下Apache配置SSL支持https
- Linux下配置APACHE支持PHP环境
- Linux下安装配置apache,mysql,php并支持gd,jpeg,png,freetype的方法
- FL2440移植linux-3.0全过程(5)添加u盘挂载,MMC,LCD支持等
- linux 下搭建 支持 fastcgi 的 apache 服务器
- apache添加php支持
- linux添加exFat支持
- 将apache添加为Linux系统自启动服务
- 在Linux操作系统下为Apache目录添加密码
- LINUX下为apache添加模块 配置jk_connector的模块