【问题标题】:enable the SSL on localhost not working on custom ports在 localhost 上启用 SSL 不适用于自定义端口
【发布时间】:2018-10-08 14:38:14
【问题描述】:

我正在尝试在我添加的自定义端口 8040 (localhost:8040) 上启用 SSL,我按照 video 教程来执行此操作

我有 xampp,我在 xampp\apache\bin 目录上执行了以下命令

这是三个命令的顺序

openssl genrsa -aes256 -out private.key 2048

openssl rsa -in private.key -out private.key


openssl req -new -x509 -nodes -sha1 -key private.key 
-out certificate.crt -days 36500 -config C:\xampp\apache\conf\openssl.cnf

现在我将生成的文件private.key 和certificate.crt 复制并粘贴到此目录C:\xampp\apache\conf\key 中。

我取消了httpd.conf 文件中与 SSL 相关的行的注释
和文件里面httpd-ssl.conf里面C:\xampp\apache\conf\extra

我添加了一个新目录

<VirtualHost *:8040>

DocumentRoot "C:/xampp/htdocs/laravel/public"
ServerName qa-staging.com
ServerAdmin admin@example
ErrorLog "C:/xampp/apache/logs/error.log"
TransferLog "C:/xampp/apache/logs/access.log"

SSLEngine on

SSLCertificateFile "C:/xampp/apache/conf/key/certificate.crt"

SSLCertificateKeyFile "C:/xampp/apache/conf/key/private.key"

<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "C:/xampp/apache/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>

BrowserMatch "MSIE [2-5]" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0

CustomLog "C:/xampp/apache/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

但是当我尝试打开https:\\localhost:8040 时,我得到了

此网站无法提供安全连接

现在,如果我将密钥和证书目录添加到默认端口 443

当我请求 https:\localhost

时它工作正常

【问题讨论】:

    标签: apache ssl https openssl localhost


    【解决方案1】:

    尝试在httpd.conf中添加“listen 8040”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-10
      • 2015-07-26
      • 1970-01-01
      • 2021-12-15
      • 2013-09-24
      • 2017-12-27
      • 2018-04-08
      相关资源
      最近更新 更多