我目前正在使用LAMP堆栈对一个Web项目进行本地开发。由于我的生产应用程序将使用https进行登录,因此我希望能够在本地开发环境中模拟此过程,以便所有的url保持一致。我对ssl证书还不是很熟悉,请问有没有相关参考资料可以指引我如何做呢?我需要签署自己的证书吗?证书应该放在哪里(我使用apache进行虚拟主机配置)?谢谢。
我目前正在使用LAMP堆栈对一个Web项目进行本地开发。由于我的生产应用程序将使用https进行登录,因此我希望能够在本地开发环境中模拟此过程,以便所有的url保持一致。我对ssl证书还不是很熟悉,请问有没有相关参考资料可以指引我如何做呢?我需要签署自己的证书吗?证书应该放在哪里(我使用apache进行虚拟主机配置)?谢谢。
我是新来的,但是去这个网站找到那里的信息。
mkcert
https://github.com/FiloSottile/mkcertminica
https://github.com/jsha/minicaFishdrowned/ssl
https://github.com/Fishdrowned/ssldevilbox/cert-gen
https://github.com/devilbox/cert-genminica
,同时提供了一个openssl命令来创建自签名证书:https://letsencrypt.org/docs/certificates-for-localhost/ - Kay V我最喜欢的是Ralf为Apache modssl提供的文档。这个页面解释了如何创建一个测试证书。每当我需要创建一个测试证书时,我总是去这个页面。
显然,由于您正在使用Java和Apache,这并不会太有用,但无论如何,如果您还进行任何.Net开发,您将拥有这些工具,并且也许这可以帮助您实际生成证书。我使用的是.Net SDK中可用的makecert
,以下是我用于为本地.Net开发和IIS创建自己的SSL证书的批处理文件;
@ECHO OFF
REM
REM This script will create a certificate to enable HTTPS for the localhost in IIS
REM Complete the following steps to install the certificate
REM
REM 1. Run this file to create the certificate
REM 2. Open MMC.exe
REM 3. Click File > Add/Remove Snap In > Add and select 'Certificates'
REM 4. Select 'Computer Account'
REM 5. Select 'Local Computer' and click 'Finish', 'Close', 'OK'
REM 6. Expand Certificates > Personal > Certificates, the new certificate should be listed
REM 7. In IIS open the Properties of the Default Web Site
REM 8. Select 'Directory Security' tab and click 'Server Certificate'
REM 9. The Certificate Wizard will open, choose 'Assign Existing Certificate' [may need to cancel a pending certificate request]
REM 10. Select new certificate from list and accept change
REM 11. Ensure that the site is using the default port for SSL 443
REM
C:
CD \
CALL "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sdkvars.bat"
ECHO Creating Certificate
makecert -r -pe -n "CN=localhost" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12
PAUSE
如果您使用其他主机头访问站点,请更改"CN=localhost"
,根据您使用的Visual Studio版本,您可能需要更改CALL
语句中的路径。