wamp 创建本地 https

2018-09-25 09:48:31 阅读:19 编辑

创建证书

$ cd  D:\wamp\bin\apache\apache2.4.33\bin
$ openssl.exe genrsa -out ..\conf\server.key 1024
$ openssl.exe req -new -key ..\conf\server.key -out ..\conf\server.csr -config ..\conf\openssl.cnf
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:CN
State or Province Name (full name) [Some-State]:xiamen
Locality Name (eg, city) []:City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Company
Organizational Unit Name (eg, section) []:Section
Common Name (e.g. server FQDN or YOUR name) []:fan.test
Email Address []:123@qq.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: 不用输入,直接回车
An optional company name []:
$ openssl.exe x509 -in ..\conf\server.csr -out ..\conf\server.crt -req -signkey ..\conf\server.key -days 365

httpd.conf

#LoadModule ssl_module modules/mod_ssl.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
# 去掉 #
#Include conf/extra/httpd-ssl.conf
# 加到最后
Include conf/extra/vhosts-ssl.conf

处理 conf/extra/httpd-ssl.conf

  1. 修改 logs 路径
  2. 删除本身的 VirtualHost

    创建 vhosts-ssl.conf

    Listen 443
    <VirtualHost *:443>
    ServerName cloud.test
    ServerAlias cloud.test
    DocumentRoot "e:/edison/cloud/public"
    <Directory "e:/edison/cloud/public/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require all granted
    </Directory>
    SSLEngine on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
    SSLHonorCipherOrder on
    SSLCertificateFile "d:/wamp/bin/apache/apache2.4.33/conf/server.crt"
    SSLCertificateKeyFile "d:/wamp/bin/apache/apache2.4.33/conf/server.key"
    </VirtualHost>

注: http://www.koikikukan.com/archives/2013/12/03-012345.php vmware-hostd.exe 进程会占用 443 的端口 1. 禁用” VMware Workstation Server “服务, 一般也不会影响 VMware 的正常使用。VMware Workstation Server 服务的描述信息为 “Remote access service for registration and management of virtual machines.”,也就是说它与远程管理 VMware 有关。而我们一般也不会使用到 VMvare 的远程访问功能,所以第二种方法基本没有影响。 当 apache 不能正常启动时,要查看计算机的系统日志 (Windows)