Configure Apache to support https and apachehttps in Windows
1. Open cmd and enter F: // switch to the Apache installation path. The directory of My Apache installation is on the F disk.
2. cd F: \ Apache \ bin
3. set "openssl_conf = F: \ Apache \ conf \ openssl. cnf"
Temporarily set the openssl_conf path. You can also create a project in the environment variable. The key is OPENSSL_CONF and the value is F: \ Apache \ conf \ openssl. cnf (depending on your own installation path), otherwise the "WARNING: can't open config file: c:/openssl-1.0.2j-win64/ssl/openssl. cnf "error.
4. openssl genrsa-out server. key 1024 // generate private key
5. copy server. key server.key.org // copy server. key to prevent Apache from requiring a password
6. openssl rsa-in server.key.org-out server. key
7. openssl x509-req-days 365-in server. csr-signkey server. key-out server. crt // generate the certificate. The country, province, city, domain name, email address, and other information are required.
8. Configure Apahce !!! Core steps !!!
8.1 remove the # Before the following code from the http. conf file
# LoadModule socache_shmcb_module modules/mod_socache_shmcb.so # LoadModule ssl_module modules/mod_ssl.so # Include conf/extra/httpd-ssl.conf
8.2 modify F:/Apache/conf/extra/httpd-ssl.conf File
<VirtualHost _ default _: 443> DocumentRoot "F:/Apache/htdocs/ushark.net" ServerName www.ushark.net: 443 SSLCertificateFile "F:/Apache/bin/server. crt "SSLCertificateKeyFile" F:/Apache/bin/server. key "</VirtualHost>
9. Configure http to automatically jump to https and edit the following content in the httpd-vhosts.conf File
<VirtualHost *: 80>
DocumentRoot "F:/Apache/htdocs/ushark.net"
ServerName www.ushark.net
Redirect/https://www.ushark.net /#!!! Core code !!!
</VirtualHost>
10. httpd-k restart // restart Apache. If an error is reported, find the corresponding cause.