A lot of theoretical knowledge is not mentioned here, if you want to know more about the proposal to understand the theory and then see it will be easy to understand, the following directly.
Environment:
CentOS Release 6.8 (Final)
apache-2.4.25
1. Check if existing Apache has compiled and installed SSL module.
/usr/local/apache/bin/apachectl-l
2, no need to add SSL module, Apache is to add the module in an embedded way
/usr/local/apache/bin/apxs-i-c-a-l/usr/lib64/openssl/engines/lib-c *.c-lcrypto-lssl-ldl/usr/local/apache/bin/ap Xs-c-I mod_ssl.c/usr/local/apache/bin/apxs-c-I mod_ssl.loll/usr/local/apache/modules | grep SSL
3. Turn on the SSL extension function
Sed-i ' s/\ #Include conf\/extra\/httpd-ssl.conf/include conf\/extra\/httpd-ssl.conf/'/usr/local/apache/conf/ Httpd.confsed-n ' 140p '/usr/local/apache/conf/httpd.conf LoadModule ssl_module modules/mod_ssl.so
4. Generate untrusted certificate, public key encryption, private key decryption. Private key encryption, public key decryption
Generate Server Private key
OpenSSL genrsa-des3-out Server.key 2048
Generate a server certificate request and fill in the relevant certificate information as required
OpenSSL Req-new-key server.key-out SERVER.CSR
Visa:
OpenSSL x509-req-days 3650-in server.csr-signkey server.key-out server.crt
5. Modify the virtual host
sed -n ' 22,33p ' /usr/local/apache/conf/extra/httpd-vhosts.conf # <virtualhost *:443> serveradmin [email protected] DocumentRoot "/var/www/html" ServerName www.www.fangqiweb.org ServerAlias www.fangqi.web.org sslengine on sslcertificatefile /usr/local/apache/ conf/server.crt sslcertificatekeyfile /usr/local/apache/ conf/server.key errorlog "Logs/error/www-error_log" CustomLog "|/usr/local/sbin/cronolog /service/apache/logs/ Access/www-%y%m%d_log "&nbsP;combined </virtualhost>
6. Add Listening port
Sed-i ' 53a\listen 443 ' httpd.conf
7, check the syntax, restart Apache
/usr/local/apache/bin/apachectl-t/usr/local/apache/bin/apachectl restart
8. Test Access
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/9A/60/wKiom1lU2P6zwU32AAAhtXyAof8526.png "title=" 533n2qnmv5_$sp{xi5~wzmu.png "alt=" Wkiom1lu2p6zwu32aaahtxyaof8526.png "/>
9. If you cannot access
Does the firewall allow HTTPS through
Vhost configuration file is misconfigured
If there is an error in the master configuration file for Apache, or if the directory location information in Vhost is missing
is Apache's listening port open?
Does Apache have the correct Add SSL module
Common errors:
/usr/local/apache/bin/apachectl-t
Httpd:syntax error on line 141 Of/usr/local/apache-2.4.25/conf/httpd.conf:cannot load modules/mod_ssl.so into server:/ usr/local/apache-2.4.25/modules/mod_ssl.so: undefined symbol:ssl_cmd_sslpassphrasedialog
Solve:
/usr/local/apache/bin/apxs-a-i-c-l/usr/lib64/openssl/engines/lib-c *.C-LCRYPTO-LSSL-LDL
This article from the "10846118" blog, reproduced please contact the author!
Simple construction of Centos6.8+apache+https