- Introducing httpd-ssl.conf Files
Locate the httd-conf file in the appropriate directory is generally under the /etc/apache2/httpd.conf
Cancel the comment symbol in front of the include/private/etc/apache2/extra/httpd-ssl.conf # which introduces the httpd-ssl.conf file
- generate keys and certificates.
Since the name of the key and certificate is already configured in/private/etc/apache2/extra/httpd-ssl.conf, please do not modify the name of the generated key file in the following steps. If modified, please change the file path and name in the httpd-ssl.conf
Cd/etc/apache2
(1) sudo openssl genrsa-des3-out server.key 1024
Enter a passphrase for your private key. (Input key password will be used in the next process, random input 123456) ;
(2) OpenSSL Req-new-key server.key-out SERVER.CSR
The next province city email and so on options can be left blank and press ENTER to enter the next step
(3) sudo OpenSSL x509-req-days 365-in server.csr-signkey server.key-out server.crt
(4) Backup
CP Server.key Server.key.copy
OpenSSL rsa-in server.key.copy-out Server.key
- Restart Apache
sudo apachectl restart
Ask Https:localhost to go to the corresponding page
-
Configuration site (1) Add Namevirtualhost *:443 (2) at the bottom of the httpd-ssl.conf file and add a configuration similar to the following to <virtualhost *:443> DocumentRoot "path_to _your_projects "ServerName localhost.xxx errorlog"/private/var/log/apache2/xxx-error_log "Transferlog"/private/var /log/apache2/xxx-access_log "Sslengine onsslcertificatefile"/PRIVATE/ETC/APACHE2/SERVER.CRT " Sslcertificatekeyfile "/private/etc/apache2/server.key" </VirtualHost> Note: General to Sslcertificatefile and Sslcertificatekeyfile address with the default is good but in the configuration process if there is a problem can be aware of their address is not a problem
Done!!
The Linux system should do the same. Windows needs to be researched
Configure HTTPS access to websites on Mac Apache