The website works fine with certificat HTTPS inside the virtual machine (VM) but not outside

47 views Asked by At

My website is installed on the VM (vm azure) with WAMP Apache server. I've installed the certificate, and it works fine on the VM using HTTPS. However, from outside, the site is inaccessible, it shows this site cannot be reached. Before, when it was in HTTP, it was accessible from outside.

Here are the steps I took to install the certificate on Apache WAMP:

  1. Copy your SSL certificate (.crt file) and your private key (.key file) to the directory.
  2. Uncomment the modules:
   LoadModule ssl_module modules/mod_ssl.so 
   LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
   Include conf/extra/httpd-ssl.conf
  1. Configure httpd-ssl.conf:

    (Listen 443) is enable

<VirtualHost _default_:443>

#   General setup for the virtual host
DocumentRoot "${SRVROOT}/htdocs"
ServerName example.com
ServerAdmin [email protected]
ErrorLog "${SRVROOT}/logs/error.log"
TransferLog "${SRVROOT}/logs/access.log"
….
SSLCertificateFile "${SRVROOT}/conf/crt/certificat.crt"
#SSLCertificateFile "${SRVROOT}/conf/server-dsa.crt"
#SSLCertificateFile "${SRVROOT}/conf/server-ecc.crt"
….
.….
.….
SSLCertificateKeyFile "${SRVROOT}/conf/crt/certificat.key"
#SSLCertificateKeyFile "${SRVROOT}/conf/server-dsa.key"
#SSLCertificateKeyFile "${SRVROOT}/conf/server-ecc.key"
  1. Configure vhost:
# Virtual Hosts
#
<VirtualHost _default_:80>
  ServerName example.com
  ServerAlias example.com
  DocumentRoot "c:/wamp/www/site"
  <Directory "c:/wamp/www/site">
    AllowOverride All
    Require all granted
  </Directory>
    Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost _default_:443>
  ServerName example.com
  ServerAlias example.com
  DocumentRoot "c:/wamp/www/site"
  <Directory "c:/wamp/www/site">
    AllowOverride All
    Require all granted
  </Directory>
    SSLEngine on
    SSLCertificateFile "C:/wamp/bin/apache/apache2/conf/crt/certificat.crt "
    SSLCertificateKeyFile "C:/wamp/bin/apache/apache2/conf/crt/certificat.key"
</VirtualHost>
0

There are 0 answers