简体   繁体   中英

enable the SSL on localhost not working on custom ports

I'm trying to enable the SSL on a custom port I added which is 8040 (localhost:8040), I followed a video tutorial to do this

I've xampp and I executed the following commands on xampp\\apache\\bin directory

here are the three commands in order

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

Now I copied the generated files private.key and certificate.crt and paste them inside this directory C:\\xampp\\apache\\conf\\key .

I un-commented the lines related to the SSL inside httpd.conf file
and Inside the file httpd-ssl.conf inside C:\\xampp\\apache\\conf\\extra

I added a new directory

<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>

but when I try to open https:\\\\localhost:8040 I got

This site can't provide a secure connection

在此处输入图片说明

Now, If I added the key and certificate directories to the default port 443

It works fine when I request https:\\localhost

在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM