本文主要介绍了在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
相关推荐:
linux+nginx+mysql+php的服务器环境怎么配置配置