`
xitong
  • 浏览: 6192975 次
文章分类
社区版块
存档分类
最新评论

linux下apache2+php+ssl的安装

 
阅读更多

步骤:
1.下载并安装 openssl
2.安装apache2
./configure --prefix=你打算安装apache2的目录 --with-openssl=安装了openssl的目录 --with-apr=/usr/local/apr-httpd/ --with-apr-
util=/usr/local/apr-util-httpd/ --enable-mods-shared=all --enable-ssl --enable-so --enable-cache --enable-file-cache --enable-mem-cache --enable-disk-cache
3.安装php

 ./configure --with-apxs2=安装了apache2的目录

4.制作证书
CA的证书文件cacert.pem
# cd /usr/share/ssl/misc
# ./CA -newca
证书请求newreq.pem
# ./CA -newreq
签署证书newcert.pem
# ./CA -sign
# mkdir /usr/local/apache2/conf/ssl.crt/
# mkdir /usr/local/apache2/conf/ssl.key/
# cp newcert.pem /usr/local/apache2/conf/ssl.crt/server.pem
# cp newreq.pem /usr/local/apache2/conf/ssl.key/server.pem

5.修改apache配置文件
更改服务器的证书文件的相关配置
# vi /usr/local/apache2/conf/extra/httpd-ssl.conf

SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.pem
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.pem

<Directory "你的ssl根目录">
Options -Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>

6.启动apache+ssl
HTTPD起动时需要输入口令

备注:
打开端口的命令:
iptables -t filter -A INPUT -d 192.168.0.5 -p tcp --dport 8080 -j ACCEPT

参考了如下资料
1. http://www.linuxdiyf.com/viewarticle.php?id=66493
2. http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/ssl/ssl_howto.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics