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, install httpd yum install httpd mod_ssl-y 3, install OpenSSL yum installs openssl-y here httpd the default profile path, www path, The default certificate path, the default private key path.configuration file path/etc/httpd/conf/httpd.confwww storage path/var/www/htmlthe default certificate path/etc/pki/tls/certs/The default private key path/etc/pki/tls/private/4. Create a certificate file using OpenSSL 1. Establish a server key OpenSSL genrsa-out server.key 1024 2. Set up the server public key, here will let you enter some certificate properties, you can lose on the line, and finally lose 2 times more than 4 digits of the password OpenSSL Req-new-key Server.key-out SERVER.CSR 3. Establishing a server certificate OpenSSL x509-req-days 365-in server.csr-signkey server.key-out Serv ER.CRT 5, vim/etc/httpd/conf/httpd.conf Modify configuration file # Listen #前面加个 # save #添加如下代码RewriteEngine Onrewritecond%{https }!=onrewriterule ^ (. *) https://%{server_name}$1 [l,r] 6, vim/etc/httpd/conf.d/ssl.conf the certificate path here please fill in the path you only use OpenSSL to generate the certificate, red The color section is not necessarily my path here sslcertificatekeyfile/opt/server.keySslcertificatefile/OPT/SERVER.CRT7. Start the httpd service, my release version is Rhel 7.3 so the command changed to Systemctl, if the 6.* version, please use service httpd start Systemctl start httpd or service httpd start 8, with IE browser verification, because this is a self-signed certificate, the browser will be reported unsafe, point to continue the traffic just fine. Input on client: https://Server IP address
Apache+ssl HTTPS Hypertext transfer on Linux, close port 80