本文主要介绍了在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
立即学习“PHP免费学习笔记(深入)”;
# ./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
相关阅读:
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号