This article mainly introduces the details and configuration of installing apache2+php+ssl under Linux.
Steps:
1. Download and install openssl
2. Install 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. Install php
./configure --with-apxs2=安装了apache2的目录
4. Make certificate
CA’s certificate file cacert.pem
# cd /usr/share/ssl/misc # ./CA -newca
Certificate request newreq.pem
# ./CA -newreq
Sign certificate 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. Modify the apache configuration file
Change the relevant configuration of the server’s certificate file
# 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. Start apache+ssl
HTTPD requires a password when starting
Note:
Command to open the port:
iptables -t filter -A INPUT -d 192.168.0.5 -p tcp --dport 8080 -j ACCEPT
Refer to the following information
1. http://www.linuxdiyf.com/viewarticle.php?id=66493
2 . http://man.chinaunix.net/newsoft/ApacheMenual_CN_2.2new/ssl/ssl_howto.html
##Related reading:
How to detect whether PHP SSL is turned on in windows server and how to turn on SSL
##Use OpenSSL to generate certificates and encrypt and decrypt in php
nginx and node deploy https method steps in Alibaba Cloud
The above is the detailed content of Installation of apache2+php+ssl under linux. For more information, please follow other related articles on the PHP Chinese website!