Transferred from: https://www.cnblogs.com/ccccwork/p/6529367.html
1, to build HTTPS, must have something
1, Hypertext Transfer Protocol httpd (Apache) and SSL module (MOD_SSL)2, the certificate used to encrypt the hyper-file transfer. (OpenSSL makes self-signed certificate)3, test
2, installation httpd
Yum Install httpd mod_ssl-y
3. Installing OpenSSL
Yum Install Openssl-y
/etc/httpd/conf//var/www//etc/pki/tls/certs//etc/pki/tls/private/
4. Use OpenSSL to generate certificate files "Attention! The certificate file is generated here in the current directory "
1-out server.key 10242-new-key server.key-outSERVER.CSR3-req-days 365-in< /c10> Server.csr-signkey server.key-out SERVER.CRT
5, vim/etc/httpd/conf/httpd.conf Modify the configuration file "#如果不配置此段, the use of HTTP access will not automatically jump to HTTPS, but the HTTPS input corresponding to the port can be accessed, That is, the same machine can have both HTTP and https "
# Add the following code to enable automatic use of the HTTPS protocol to open Web sites %{https}!= ^ (. *) https://%{server_name}$1 [l,r]
6, vim/etc/httpd/conf.d/ssl.conf, modify the SSL configuration file, specify the private key and the certificate's directory.
sslcertificatekeyfile/opt//opt/server.crt # # #注意! The path here is the path where the certificate is generated in step "4, Generate certificate files with OpenSSL"
7. Start the httpd service, my release version is Rhel 7.3 so the command changed to Systemctl, if it is 6.* version, please use service httpd start
Systemctl start httpd or service httpd start
8, with IE browser authentication, because this is a self-signed certificate, the browser will be reported unsafe, point to continue the traffic is good.
Input on client: https://Server IP address
Tools:apache Deploying HTTPS Services