1

We have enabled ssl to a website. If we enter "https://example.com/" (with htpps://), it pointing to the right folder. Without https://(example.com) its pointing to the root folder(/var/www/html). How to point both to the right folder "/var/www/html/example.com/public_html"?

.conf as follows

<Directory /var/www/html/example.com/public_html>
    Require all granted
</Directory>

<VirtualHost xx.xx.xx.xx:443>
        SSLEngine On
        SSLCertificateFile /etc/apache2/ssl/example.crt
        SSLCertificateKeyFile /etc/apache2/ssl/example.key
        SSLCACertificateFile /etc/apache2/ssl/example.cer

        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin test@example
        DocumentRoot /var/www/html/example.com/public_html

        ErrorLog /var/www/html/example.com/logs/error.log
        CustomLog /var/www/html/example.com/logs/access.log combined

</VirtualHost>
  • What does "without https://(example.com)" mean exactly? – Tero Kilkanen Mar 4 '17 at 11:27
  • https:// and http:// – Johnl Mar 4 '17 at 12:47
  • Give concrete text strings what the "without" means, I cannot figure out from your reply what exactly is meant by them. – Tero Kilkanen Mar 4 '17 at 16:28
0

Adding the follollowing to the config should do it (unless the ServerName or ServerAlias directives with value example.com is already defined somewhere earlier in a VHost):

<VirtualHost *:80>
        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin test@example
        DocumentRoot /var/www/html/example.com/public_html
        ErrorLog /var/www/html/example.com/logs/error.log
        CustomLog /var/www/html/example.com/logs/access.log combined
</VirtualHost>
| improve this answer | |
  • You are welcome. Why don't you accept the answer? – rda Mar 4 '17 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.