wamp服务器中的SSL安装:httpd-SSL.conf中的错误

wamp服务器中的SSL安装:httpd-SSL.conf中的错误,ssl,ssl-certificate,wampserver,apache2.4,Ssl,Ssl Certificate,Wampserver,Apache2.4,我正在尝试在本地主机上设置ssl,我已经遵循了和许多其他方法,但未能成功。我坚持使用httpd-ssl.conf的语法。当我设置 <Directory "c:/wamp/www/"> Options Indexes FollowSymLinks AllowOverride all Require all granted SSLOptions +StdEnvVars </Directory> 选项索引跟随符号链接 允许超越所有 要求所有

我正在尝试在本地主机上设置ssl,我已经遵循了和许多其他方法,但未能成功。我坚持使用httpd-ssl.conf的语法。当我设置

<Directory "c:/wamp/www/"> 
   Options Indexes FollowSymLinks  
   AllowOverride all 
   Require all granted 
   SSLOptions +StdEnvVars
</Directory>

选项索引跟随符号链接
允许超越所有
要求所有授权
发展+标准
我也试过很多类似的方法

<Directory "c:/wamp/www/"> 
   SSLOptions +StdEnvVars
</Directory>

发展+标准

什么问题无法获取……

如何配置WAMPServer以使用HTTPS SSL

这不是一个简单的过程。希望本教程能让SSL为您工作。 然而,一旦它正常工作,正确配置它完全取决于您

本教程基于一个名为www.wamphelpers.dev的网站的创建,因此无论您在哪里看到该名称,都可以将其更改为您试图保护的网站名称

我首先在\wamp\www\wamphelpers中创建了一个不安全的站点

\wamp\bin\apache\apache{version}\conf\extra\httpd vhosts.conf

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/wamphelpers"
    ServerName wamphelpers.dev
    ServerAlias www.wamphelpers.dev
    <Directory  "c:/wamp/www/wamphelpers">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
现在从windows使用“以管理员身份运行”启动的命令重新启动dnscache,如下所示

net stop dnscache
net start dnscache
然后在\wamp\www\wamphelpers\index.php中创建了一个简单脚本

<?php
    echo 'Hello, this is the WAMPHELPERS.DEV site homepage';
?>
然后像这样删除
#
注释字符

# Virtual hosts
Include conf/extra/httpd-vhosts.conf
保存文件

现在重新启动Apache并确保简单的非安全虚拟托管站点在继续之前工作


openssl工具包。 openssl.exe、ssleay32.dll和libeay32.dll随附并位于C:\wamp\bin\apache\apachex.y.z\bin文件夹中 这就是创建自签名证书所需的全部内容

但是:这些在我安装的任何Apache版本上都不适用。 我总是收到这个错误消息

序号的变化取决于我所在的apache版本文件夹

如果你遇到这个错误,不要担心,这是你需要做的

安装最新版本的OPENSSL工具包

这是可以得到的

注意:暂时不要使用V1.1版本,PHP团队还没有使用这些新链接编译PHP,所以请坚持使用V1.0。?直到他们这样做

选择最新版本的“Win32 OpenSSLv xxx Light”或“Win32 OpenSSLv xxx Light”以匹配您安装的WAMPServer版本,因为这是您所需要的全部

这将下载一个.exe文件,您可以运行该文件来安装此工具包

它会问以下问题,我建议你这样回答,这样你就不会在C:\windows\system32中安装某些东西。 毕竟,这是一个工具包,它经常发生变化。最好将这些东西分开,不要使它们成为全球系统

安装后(安装到您在安装中指定的任何文件夹),您应该准备好开始生成密钥和证书的过程


生成密钥和证书。

步骤1:生成RSA私钥

首先,我们需要为自己创建一个证书。 正常(付费)过程是创建证书,然后将其传递给签名机构。 这就是为什么要花钱的原因,因为他们必须尽职尽责地检查你是你所说的人,并且你将使用证书的网站是真实和合法的

openssl工具包用于生成用于证书的RSA私钥和CSR(证书签名请求)。 第一步是创建RSA私钥。 该密钥是一个1024位RSA密钥,使用三重DES加密,并以PEM格式存储,因此可作为ASCII文本读取

使用[b]以管理员身份运行[/b]打开命令窗口(Dos框) 将目录更改为上面安装OpenSSL工具包的位置。 就我而言,这是

CD c:\apps\OpenSSL-Win32\bin
制作一个文件夹,将输出放入(保持垃圾箱文件夹整洁)我使用的网站

md website
现在输入以下命令:

openssl genrsa -out website\server.key 2048
这应该在网站文件夹中创建一个名为server.key的文件,如果没有密码,请检查它是否存在

步骤2:生成CSR(证书签名请求)

在生成CSR期间,系统将提示您输入几条信息。 这些是证书的X.509属性。 其中一个提示是“公共名称(例如服务器FQDN或您的名称)[]:”。 此字段必须填写受SSL保护的服务器的完全限定域名。 因此,如果要保护的网站将
https://www.wamphelpers.dev
,然后在此提示下输入
www.wampheplers.dev
。我使用
wamphelper.dev
作为我的
ServerName
ServerName wamphelpers.dev

不要输入任何问题:质询密码[]:]只需按enter键。 如果您在这里输入密码短语,当您使用SSL配置启动Apache时,Apache将不会启动,并将给出以下错误消息:-

[错误]初始化:Win32上不支持SSLPassPhraseDialog内置

基本上,如果您输入了一个密码短语,Apache应该在每次启动时向您询问该密码短语。 这显然不会让你的生活变得更轻松,但主要是在windows上,它实际上不起作用,而且会起作用 导致Apache在尝试请求密码短语时崩溃,出现上述错误

生成CSR的命令如下所示:

openssl req -new -key website\server.key -out website\server.csr


Example question and answers:
Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]: Hampshire
Locality Name (eg, city) []: Portsmouth
Organization Name (eg, company) [Internet Widgits Pty Ltd]: Wamp Helpers Ltd
Organizational Unit Name (eg, section) []: Information Technology
Common Name (e.g. server FQDN or YOUR name) []: wamphelpers.dev
Email Address []: me@wamphelpers.dev

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ( leave blank just hit the enter key )
An optional company name []: ( leave blank just hit the enter key )
步骤3:生成自签名证书

此时,您需要生成一个自签名证书,因为 您可能不打算让CA对您的证书进行签名,或者希望进行测试 CA对证书进行签名时新的SSL实现

预警 这个证书
openssl genrsa -out website\server.key 2048
openssl req -new -key website\server.key -out website\server.csr


Example question and answers:
Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]: Hampshire
Locality Name (eg, city) []: Portsmouth
Organization Name (eg, company) [Internet Widgits Pty Ltd]: Wamp Helpers Ltd
Organizational Unit Name (eg, section) []: Information Technology
Common Name (e.g. server FQDN or YOUR name) []: wamphelpers.dev
Email Address []: me@wamphelpers.dev

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: ( leave blank just hit the enter key )
An optional company name []: ( leave blank just hit the enter key )
openssl x509 -req -days 365 -in website\server.csr -signkey website\server.key -out website\server.crt


Example output:
Loading 'screen' into random state - done
Signature ok
subject=/C=GB/ST=Hampshire/L=Portsmouth/O=WampHelpers Ltd/OU=Information Technology/CN=www.wamphelpers.dev/emailAddress=riggsfolly@wamphelpers.dev
Getting Private key
md c:\wamp\bin\apache\apachex.y.z\conf\ssl.key
md c:\wamp\bin\apache\apachex.y.z\conf\ssl.crt
copy website\server.crt c:\wamp\bin\apache\apachex.y.z\conf\ssl.crt
copy website\server.key c:\wamp\bin\apache\apachex.y.z\conf\ssl.key
LoadModule authn_socache_module modules/mod_authn_socache.so

LoadModule ssl_module modules/mod_ssl.so

LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf
extension=php_openssl.dll
DocumentRoot "c:/Apache2/htdocs"
ServerName www.example.com:443
ServerAdmin admin@example.com
ErrorLog "c:/Apache2/logs/error.log"
TransferLog "c:/Apache2/logs/access.log"
DocumentRoot "c:/wamp/www/wamphelpers"
ServerName wamphelpers.dev:443
ErrorLog "c:/wamp/logs/ssl_error.log"
TransferLog "c:/wamp/logs/ssl_access.log"
SSLCertificateFile "c:/Apache2/conf/server.crt"
SSLCertificateFile "c:/wamp/bin/apache/apachex.y.x/conf/ssl.crt/server.crt"
SSLCertificateKeyFile "c:/Apache2/conf/server.key"
SSLCertificateKeyFile "c:/wamp/bin/apache/apachex.y.x/conf/ssl.key/server.key"
<Directory "c:/Apache2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
<Directory "c:/wamp/www/wamphelpers">
    SSLOptions +StdEnvVars
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 localhost ::1
</Directory>
<Directory "c:/wamp/www/wamphelpers">
    SSLOptions +StdEnvVars
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require local
</Directory>
SSLSessionCache        "shmcb:c:/Apache2/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300
SSLSessionCache        "shmcb:c:/wamp/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300
CustomLog "c:/Apache24/logs/ssl_request.log" \
      "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
CustomLog "c:/wamp/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
cd \wamp\bin\apache\apachex.y.z\bin
httpd -t
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = 127.0.0.1
DNS.2 = localhost
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so 
ErrorLog "c:/wamp/bin/apache/apache2.4.23/logs/ssl_error.log"
<Directory "c:/wamp/www/">
    SSLOptions +StdEnvVars
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require local
</Directory>
  CustomLog "c:/wamp/bin/apache/apache2.4.23/logs/ssl_request.log"
https://blog.mozilla.org/security/2014/09/23/phasing-out-certificates-with-sha-1-based-signature-algorithms/