Linux+Apache配置ssl


转载自:网络安全博客
原始链接:http://www.safe121.com/post-40.html

先开启ssl :a2enmod ssl
之后建立证书
先建立一个放证书的文件夹,建那里都行: mkdir /home/cert
之后把证书丢到刚才建立的目录:
openssl req -x509 -newkey rsa:1024 -keyout /home/cert/x73.pem -out /home/cert/x73.pem -nodes -days 9999999999999
然后编辑下apache的默认配置文件: vim /etc/apache2/sites-available/default (我比较习惯用nano,vi太尼玛强大了)
打开尼玛的编辑器,在最后一行写入

<VirtualHost *:443>
ServerSignature On
SSLEngine On
SSLCertificateFile SSL路径(/home/cert/x73.pem)
ServerAdmin x@x73.cc
DocumentRoot “/网站路径”
php_admin_value open_basedir “/网站路径:/tmp”
ServerName 域名
ServerAlias 域名
CustomLog /网站路径/log-ssl combined
</VirtualHost>

\

然后输入: /etc/init.d/apache2 restart
重启apache服务,当然也可以: service apache2 restart
你就可以用https访问了

\

相关内容

    暂无相关文章