Apache+ssl HTTPS Hypertext transfer on Linux, close port 80

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.