I am setting up SSL on my Apache/2.4.6 RHEL server. In httpd.conf
, have VirtualHosts as shown below…
<VirtualHost *:80>
ServerName foo.bar
Redirect permanent / https://foo.bar
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /path/to/file
ServerName foo.bar
SSLEngine on
SSLCertificateFile /path/to/file
SSLCertificateKeyFile /path/to/file
SSLCertificateChainFile /path/to/file
</VirtualHost>
When I comment out DocumentRoot in httpd.conf outside of the VirtualHosts, the web browser returns error 404 The requested URL / was not found on this server.
Do I need to have a DocumentRoot outside of VirtualHost *:443
? If not, what is going on when I comment it out?
Best Answer
You will have in some apache config a DocumentRoot defined, which is likely not accessible by the server, you can check this by issuing for RHEL flavours:
and Debian
It should contain a variable:
You can either adjust this or set one in the virtual host section (I would prefer this one, being set to the same of the SSL vhost).