Configure Apache to support https and apachehttps in Windows

Source: Internet
Author: User
Tags openssl rsa openssl x509

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.

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.