I have a Virtual Host Setup on an Apache2 Server on a Debian VM, I've created an SSL certificate from GoDaddy and downloaded the crt files (certificate and chain)
Before adding SSL, The DocumentRoot
was pointing to :
-
/var/www/html/websitename/public_html/loader.php
and it was working just fine.
But, as I added SSLEngineOn
, SSLCertificationFile
, and SSLCertificationChainFile
in the Virtual Host, the Apache2 Server refuses to start, here's the server log:
May 07 20:05:05 ns507219 systemd[1]: Starting The Apache HTTP Server...
May 07 20:05:05 ns507219 apachectl[2228]: AH00112: Warning: DocumentRoot [/var/www/html/websitename/public_html/loader.php] does not exist
May 07 20:05:05 ns507219 apachectl[2228]: AH00112: Warning: DocumentRoot [/var/www/html/websitename/public_html/loader.php] does not exist
May 07 20:05:05 ns507219 apachectl[2228]: AH00112: Warning: DocumentRoot [/var/www/html/websitename/public_html/loader.php] does not exist
May 07 20:05:05 ns507219 apachectl[2228]: Action 'start' failed.
Here's my config :
<VirtualHost websitename.ca:80>
ServerAdmin admin@websitename.ca
#SSLEngine on
#SSLCertificateFile /etc/ssl/certs/mycertificate.crt
#SSLCertificateChainFile /etc/ssl/certs/mychain.crt
DocumentRoot /var/www/html/websitename/public_html/loader.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<FilesMatch "\.php$">
SetHandler "proxy:fcgi://127.0.0.1:9000/"
</FilesMatch>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost websitename.ca:443>
ServerAdmin admin@websitename.ca
DocumentRoot /var/www/html/websitename/public_html/loader.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/mycertificate.crt
SSLCertificateChainFile /etc/ssl/certs/mychain.crt
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
If I remove the if condition, the settings work normally, but SSL doesn't.