简体   繁体   中英

Unable to configure SSL to httpd-vhosts.conf

I'm using the ubuntu 16.04 server & lampp server and I get this error XAMPP: Your /etc/hosts is not okay. I will fix it. XAMPP: Your /etc/hosts is not okay. I will fix it. when I uncomment this line #SSLEngine on

So far it is running fine in port 80 I want to add SSL to it

Please help me out.

My httpd-vhosts.conf file

<VirtualHost 127.0.0.4:443>
  DocumentRoot "/opt/lampp/htdocs/example.com/public"
  ServerName example.com
  DirectoryIndex index.php

  #SSLEngine on
  #SSLCertificateFile /etc/letsencrypt/live/example.com/privkey.pem
  #SSLCertificateKeyFile /etc/letsencrypt/live/example.com/cert.pem
  #SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem
  <Directory "/opt/lampp/htdocs/example.com/public">
        Options All
        AllowOverride All
        Require all granted
  </Directory>
</VirtualHost>

My /etc/hosts file

127.0.0.1       localhost
127.0.0.4       example.com

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

The error when I uncomment #SSLEngine on

XAMPP:  Starting diagnose... 
XAMPP: Your /etc/hosts is not okay. I will fix it.
XAMPP:  Next try...

The reason is I have provided the privkey.pem in SSLCertificateFile & cert.pem in SSLCertificateKeyFile

#SSLCertificateFile /etc/letsencrypt/live/example.com/privkey.pem
#SSLCertificateKeyFile /etc/letsencrypt/live/example.com/cert.pem

After changing to this it worked fine & no need of SSLCertificateChainFile

SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

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