linux下apache2+php+ssl的安装

*文
*文原创
2023-03-18 08:32:011613浏览

本文主要介绍了在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

相关阅读:

windows服务器中检测PHP SSL是否开启以及开启SSL的方法

php中使用OpenSSL生成证书及加密解密

nginx 和 node在阿里云部署https方法步骤


以上就是linux下apache2+php+ssl的安装的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。