狮子的雄心,骆驼的耐力,孩子的执著!
分类: 系统运维
2016-12-14 17:10:42
openssl Windows下已编译好的命令行程序:
lamp开启ssl
首先需要安装openssl和apache的ssl模块,执行:
yum install openssl mod_ssl -y
即可,接下来的配置方法和以下内容类似
wamp开启SSL
设置配置文件(httpd-ssl.conf conf/extra目录中)
SSLMutex "file:D:/ProgramFiles2003/wamp/wamp/Apache2/logs/ssl_mutex"
修改为68: SSLMutex default二,证书生成的方法
windows的——
#命令行中进入apache/bin目录下执行如下:openssl req -config ../conf/openssl.cnf -new -out server.csr -keyout server.pem
其中openssl.cnf为apache自带的openssl配置文件,引用到该文件的完整路径
输入两次密码,随便什么密码,然后一直回车,跳过下面的输入
#签发证书openssl rsa -in server.pem -out server.key
输入刚才制定的密码
#生成密钥文件
的——
生成服务器私钥:
#openssl genrsa -des3 -out server.key 1024
生成服务器证书请求,并按要求填些相关证书信息:
#openssl req -new -key server.key -out server.csr
签证:
# openssl x509 -req -days 700 -in server.csr -signkey server.key -out server.cert
Signature ok
apachectl start 启动跳过输入密码验证:
How can I get rid of the pass-phrase dialog at Apache startup time? The reason why this dialog pops up at startup and every re-start is that the RSA private key inside your server.key file is stored in encrypted format for security reasons. The pass-phrase is needed to be able to read and parse this file. When you can be sure that your server is secure enough you perform two steps:Remove the encryption from the RSA private key (while preserving the original file):
$ cp server.key server.key.org $ openssl rsa -in server.key.org -out server.key Make sure the server.key file is now only readable by root: $ chmod 400 server.key
OK,恭喜你可以正常使用HTTPS来访问你的根目录了。
当然我们还需要ssl的虚拟主机
那就要配置虚拟主机文件,在文件中专门写一个监听443端口的虚拟主机,例如:
DocumentRoot /home/ownfire/www/woosau
ServerName woosau
SSLEngine on
SSLCertificateFile /etc/httpd/conf/server.crt
SSLCertificateKeyFile /etc/httpd/conf/server.key
因为规定主机名是woosau,所以还要写一个虚拟主机名规则
NameVirtualHost woosau:443
好了,完毕,这样就可以访问了