Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

https url shows unable to connect

I have few sites which did not have SSL cert setup. The issue I am facing is, if these sites access using https it shows Unable to connect, Browser can't establish a connection to the server at mysite.com error

I think it should give a Your connection is not secure warning and give an option to go to the site

I cannot redirect https to http since there is no connection with the server

Done few searches but nothing shows up other than setting up https and troubleshooting.

I'm using ubuntu server with apache2 installed. It will be great if anyone can advice where to look/start. Thanks!

like image 407
ASR Avatar asked Apr 18 '26 07:04

ASR


1 Answers

Unable to connect, Browser can't establish a connection to the server at mysite.com

This error can be shown when either apache or virtual host itself cannot be reached over port 443.
You can check it with:

netstat -ntpl | grep apache2

In case apache does not losten on port 443 you should enable mod_ssl for apache:

a2enmod ssl

Restart apache and check that it listens on port 443 using netstat.
And finally make sure that at least self-signed certificate is configured.

In case you use apache virtual hosts and apache itself listens on port 443 then you need to configure virtual hosts to be accessible over port 443 (I suppose this is your case).
Modify the virtual host configuration file like below:

<IfModule mod_ssl.c>
   <VirtualHost xxx.xxx.xxx.xxx:443>
      ServerName "example.com:443"
      ...
      DocumentRoot ...
      ...
      SSLEngine on
      SSLVerifyClient none
      SSLCertificateFile /path/to/self-signed/certificate
      ...
   </VirtualHost>
</IfModule>

<VirtualHost xxx.xxx.xxx.xxx:80>
   ServerName "example.com:80"
   ...
</VirtualHost>
like image 50
Elvis Plesky Avatar answered Apr 20 '26 04:04

Elvis Plesky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!