Installation of apache2+php+ssl under linux

*文
Release: 2023-03-18 08:32:01
Original
2297 people have browsed it

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
Copy after login

3. Install php

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

4. Make certificate
CA’s certificate file cacert.pem

# cd /usr/share/ssl/misc
# ./CA -newca
Copy after login

Certificate request newreq.pem

# ./CA -newreq
Copy after login


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
Copy after login

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
Copy after login
SSLCertificateFile /usr/local/apache2/conf/ssl.crt/server.pem
SSLCertificateKeyFile /usr/local/apache2/conf/ssl.key/server.pem
Copy after login
<Directory "你的ssl根目录">
    Options -Indexes 
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template