Wampserver configuration https in windows environment

Because the company's business is mainly carried out on WeChat, our daily development tasks as programmers are dealing with WeChat. At this time, we need to configure the port mapping locally to the external network, which is convenient for us on WeChat client. to debug.

There is a need recently, so it is necessary to configure https (port 443) for development. Because our local development environment uses wampserver -- apache, that is, I need to configure https on apache.

In the past, it was quite easy to configure https on linux, so I thought it could be solved at one time this time. So my steps are as follows:

1. Apply for the relevant ssl certificate in Tencent Cloud, and put the certificate in the C:\wamp64\bin\apache\apache2.4.23\conf directory;

2. Edit the conf/httpd.conf file in the Apache root directory, find  the #LoadModule ssl_module modules/mod_ssl.so sum  #Include conf/extra/httpd-ssl.conf, and remove the preceding #number;

3. In order to test whether the introduction is correct, I restarted wamp. At this time, an accident happened. Wamp has always been orange, not the green color (green);

I tried    LoadModule ssl_module modules/mod_ssl.so  adding # and restarted and found that it still couldn't start.

put it again Include conf/extra/httpd-ssl.conf  注释掉,重启之后就可以正常了。

于是我确定是这个httpd-ssl.conf文件有问题。

Finally, it was found that there were several places in the file that wrote c:\apache\..., after confirmation and analysis, among them

SSLCertificateKeyFile
SSLSessionCache 
SSLCertificateFile 
SSLCertificateChainFile

The path after these four sentences is actually the real path of our own certificate. At the beginning, we did not modify it, but directly wrote a new one according to the guidance of Tencent Cloud, but it always failed in the end.

So after the modification our code should look like this

<VirtualHost *:443>
DocumentRoot "c:/wamp64/www/{项目路径}"
ServerName www.a.com:443
ServerAdmin [email protected]
ErrorLog "c:/wamp64/logs/error.log"
TransferLog "c:/wamp64/logs/access.log"
SSLEngine on
SSLCertificateFile "c:/wamp64/bin/apache/apache2.4.23/conf//2_www.a.com.crt"
SSLCertificateKeyFile "c:/wamp64/bin/apache/apache2.4.23/conf/3_www.a.com.key"
SSLCertificateChainFile "c:/wamp64/bin/apache/apache2.4.23/conf/1_root_bundle.crt"
</VirtualHost>

 

Finally, I restarted wamp in the mood to try it out. Something interesting happened, and it started normally.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324478096&siteId=291194637