如何在 Wamp Server 中启用 SSL? [英] How to enable SSL in Wamp Server?

查看:25
本文介绍了如何在 Wamp Server 中启用 SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过在网上搜索它,但我很困惑.我没搞清楚.

I have tried searching for it online, but I got confused. I didn't get any clarity.

推荐答案

STEP BY STEP教程

复制自链接:

在 WAMP 上启用 SSL

这个分步指南解释了如何在 WAMP 上启用 SSL.

This step by step guide explains how you can enble SSL on WAMP.

  1. 此处下载 WampServer 2.0 并将其安装到默认位置 (c:wamp).

  1. Download WampServer 2.0 from here and install it to the default location (c:wamp).

现在,我们需要一个私钥/公钥对以及一个 CA 来签署我们的公钥.

Now, we need to have a private/public key pair as well as a CA to sign our public key.

首先,让我们看看如何创建私钥/公钥对.

First, lets see how we can create a private/public key pair.

keytool -genkey -alias rpcert -keyalg RSA -keysize 1024 -dname "CN=identity-rp,L=SL,S=WS,C=LK" -keypass wso2key -keystore rpkeystore.jks -storepass wso2key

这将创建一个带有公钥/私钥对的密钥库 [rpkeystore.jks].

This will create a keystore [rpkeystore.jks] with public/private key pair.

我的上一篇文章解释了如何导出您的私钥从密钥库.只需按照那里给出的步骤操作,您就会得到一个文件 server.key,它是您的私钥.

My previous post explains how you can export your private key from the keystore. Just follow the steps given there and you'll end up with a file server.key, which is your private key.

现在,我们需要使用 CA 签署我们的公共证书.

Now, we need to sign our public certificate with a CA.

这 - 需要我们创建一个示例 CA,下面解释了如何做到这一点.

This - requires us to create a sample CA and following explains how to do that.

这里我们使用 OpenSSL 来构建所需的 CA 基础设施.对于 Windows,您可以从这里下载 Win32 OpenSSL v0.9.8g.

Here we use OpenSSL to build the required CA infrastructure. For Windows you can download Win32 OpenSSL v0.9.8g from here.

安装后,请确保将 C:OpenSSLin [i.e [INSTALLED_LOCATION]in] 添加到 PATH 环境变量.

Once installed make sure you add C:OpenSSLin [i.e [INSTALLED_LOCATION]in] to the PATH env variable.

openssl req -x509 -newkey rsa:1024 -keyout cakey.pem -out cacert.crt

以上内容将为我们的示例 CA 创建一个公钥/私钥对.

The above will creare a public/private key pair for our sample CA.

现在,我们需要向我们的服务器创建一个证书签名请求.

Now, we need to create a certificate signing request to our server.

转到您创建密钥库 [rpkeystore.jks] 的文件夹并发出以下命令.

Go to the folder where you created the keystore [rpkeystore.jks] and issue the following command.

keytool -certreq -v -alias rpcert -file csr.pem -keypass wso2key -storepass wso2key -keystore rpkeystore.jks 

现在将 csr.pem 复制到您为 CA 生成密钥的文件夹中,并从那里发出以下命令.

Now copy the csr.pem to the folder where you generated keys for the CA and issue the following command from there.

openssl x509 -req -days 365 -in csr.pem -CA cacert.crt -CAkey cakey.pem -CAcreateserial -out server.crt

现在我们已经拥有了所有需要的文件.

By now we have all the requiured files.

cacert.crt --> CA 公共证书server.crt --> 由 CA 签署的服务器公共证书server.key --> 服务器私钥.

cacert.crt --> CA public certificate server.crt --> Server public certificate signed by the CA server.key --> Server private key.

将以上三个文件全部复制到 c:wampinapacheapache2.2.8conf 假设您将 WAMP 安装到默认位置.

Copy all the above three files to c:wampinapacheapache2.2.8conf assuming you installed WAMP to the default location.

同时编辑 c:WINDOWSsystem32driversetchosts 文件并添加以下条目.

Also edit c:WINDOWSsystem32driversetchosts file and add the following entry.

127.0.0.1 identity-rp

如果您还记得,当我们为我们的服务器创建公共证书时,我们是为 identity-rp 创建的.

If you could recall, when we creating the public certificate for our server, we created it for identity-rp.

  1. 编辑 httpd.conf [C:wampinapacheapache2.2.8conf]

取消注释以下两行.

LoadModule ssl_module modules/mod_ssl.so

Include conf/extra/httpd-ssl.conf

找到 Listen 80 并将其更改为 Listen 12081 - 即我们的服务器在端口号 12081 上运行.

Find Listen 80 and change it to Listen 12081 - that is our server is running on port number 12081.

找到ServerName并将其设置为ServerName identity-rp:12081.

Find ServerName and set it to ServerName identity-rp:12081.

  1. 编辑 httpd-ssl.conf [C:wampinapacheapache2.2.8confextra]

  1. Edit httpd-ssl.conf [C:wampinapacheapache2.2.8confextra]

设置监听身份-rp:12444 - 我们正在监听端口 12444 以进行安全通信.

Set Listen identity-rp:12444 - we are listening to port 12444 for secure communication.

设置

设置 DocumentRoot "C:/wamp/www/"

Set DocumentRoot "C:/wamp/www/"

设置服务器名称身份-rp:12444

Set ServerName identity-rp:12444

对于整个文件,找到C:/Program Files/Apache Software Foundation/Apache2.2"并替换为C:/wamp/bin/apache/apache2.2.8".

For the entire file find "C:/Program Files/Apache Software Foundation/Apache2.2" and replace with "C:/wamp/bin/apache/apache2.2.8".

找到 SSLCertificateFile 并设置 SSLCertificateFile "C:/wamp/bin/apache/apache2.2.8/conf/server.crt"

Find SSLCertificateFile and set SSLCertificateFile "C:/wamp/bin/apache/apache2.2.8/conf/server.crt"

找到 SSLCertificateKeyFile 并设置 SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.2.8/conf/server.key"

Find SSLCertificateKeyFile and set SSLCertificateKeyFile "C:/wamp/bin/apache/apache2.2.8/conf/server.key"

找到 SSLCACertificateFile 并设置 SSLCACertificateFile "C:/wamp/bin/apache/apache2.2.8/conf/cacert.crt"

Find SSLCACertificateFile and set SSLCACertificateFile "C:/wamp/bin/apache/apache2.2.8/conf/cacert.crt"

  1. 编辑 php.ini (C:wampinapacheapache2.2.8in)

取消注释行 extension=php_openssl.dll

  1. 现在我们完成了 - 进行语法检查并启动 apache 服务器.

  1. Now we are done - do a syntax check and start the apache server.

:> cd C:wampinapacheapache2.2.8in:> httpd -t:> httpd --start

:> cd C:wampinapacheapache2.2.8in :> httpd -t :> httpd --start

在浏览器上输入 https://identity-rp:12444 - 您会在浏览器中看到证书错误 - 以避免在浏览器中安装 CA 证书.

Type https://identity-rp:12444 on your browser - you'll see a certificate error at the brower - to avoid it install CA certificate in your browser.

这篇关于如何在 Wamp Server 中启用 SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆