SSL certificate and Phpstudy configuration SSL Certificate

Source: Internet
Author: User
Tags ssl certificate

First, make sure that your Apache compiles the SSL module, which is the necessary condition to support SSL certificate (if not, compile, "open Phpstudy" "Other options Menu", "php extension", "Php-openssl" in front of the check box).

Create the CERT directory under Apache's installation directory, and copy all downloaded files to the Cert directory.

Open the httpd.conf file in the Conf directory under the Apache installation directory, find the following and remove the preceding "#" comment, so that the SSL module takes effect (if the module has removed comments, do not operate).

Then search for the following: "Include conf/vhosts.conf", add a reference below it: "Include conf/vhostssl.conf" as shown in


An vhostssl.conf profile is created in the Conf folder under the Apache installation directory. You can copy the httpd.conf file to save as vhostssl.conf, in accordance with the 80 configuration, another virtualhost443,vhostssl.conf

Listen 443

<virtualhost *:443>

DocumentRoot "D:\WWW\WEBMULU"

ServerName www.example.com

Serveralias example.com

Sslengine on

Sslprotocol TLSv1 TLSv1.1 TLSv1.2

Sslciphersuite high:medium:!anull:! MD5

Sslcertificatefile "D:\phpStudy\Apache\cert\public.pem"

Sslcertificatekeyfile "D:\phpStudy\Apache\cert\21564852664745.key"

Sslcertificatechainfile "D:\phpStudy\Apache\cert\chain.pem"

<directory "D:\WWW\WEBMULU" >

Options +indexes +followsymlinks +execcgi

AllowOverride All

Order Allow,deny

Allow from all

Require all granted

</Directory>

</VirtualHost>

Note: The domain name information is replaced with the domain name of the application SSL certificate binding, Sslciphersuite, Sslcertificatefile, Sslcertificatekeyfile, Sslcertificatechainfile, To configure the configuration information given by the SSL certificate you have requested and the Cert Certificate directory that you created, vhostssl.conf file name has no limit requirements, you can rename it according to your desired name, but be sure to follow the filename referenced in the httpd.conf file!

Restart Apache (It is possible to report an error, see if the 443 port is blocked or occupied by a firewall); After Apache restarts normally, you can see the security lock by entering the URL with https in the browser, and finally back up your SSL certificate!

After configuring the SSL certificate, we need to do a site 301 Redirect, the HTTP address is forced to jump to HTTPS address, Apache environment, in the site root directory Add. htaccess files,

Add the following in the. htaccess file:

Rewriteengine Onrewritebase/rewritecond%{server_port}!^443$rewriterule ^.*$ Https://%{server_name}%{request_uri} [ L,R=301]

Then save the file and upload the file to the Web site root directory,

SSL certificate and Phpstudy configuration SSL Certificate

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.