apache2 配置ssl

1 配置apache2
  ./configure --prefix=/opt/apache2 --enable-so --enable-mods-shared=all  --enable-ssl --with-ssl=/mnt/software/openssl

LoadModule ssl_module   modules/mod_ssl.so

2 生成 密钥:
用一下两条命令:
openssl genrsa -des3 -out server.key 1024

openssl req -new -key server.key -x509 -out my-server.crt -config openssl.cnf -days 3650

然后,将生成的server.key server .crt放到apache_path/conf/下面。

3 配置ssl虚拟机:

Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache        "shmcb:/opt/apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300
SSLMutex  "file:/opt/apache2/logs/ssl_mutex"
<VirtualHost _default_:443>
DocumentRoot "/www"
ServerName www.alexma.com:443
ServerAdmin you@example.com
ErrorLog "/www/logs/error_log"
TransferLog "/www/logs/access_log"
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "/opt/apache2/conf/server.crt"
SSLCertificateKeyFile "/opt/apache2/conf/server.key"
<FilesMatch "/.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/opt/apache2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" /
         nokeepalive ssl-unclean-shutdown /
         downgrade-1.0 force-response-1.0
CustomLog "/opt/apache2/logs/ssl_request_log" /
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x /"%r/" %b"
</VirtualHost>

测试 : 输入:https://www.alexma.com/index.html,查看,是否成功。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值