Apache 2.4.6 VirtualHost DocumentRoot configuration for SSL is ignored


Alx

Apache is ignoring the DocumentRoot setting in my VirtualHost configuration.

The site loads the correct DocumentRoot via http on port 80 , but when accessed via https on port 443 , it loads apache's default DocumentRoot instead ./var/www/htmlvar/www/mysite

The SSL certificate does load correctly, it's just the DocumentRoot being ignored.

I am running Apache/2.4.6 on CentOS.

The configuration is as follows:

# /etc/httpd/vhost.d/mysite.mylabserver.com_httpd.conf

<VirtualHost *:80>
        ServerName mysite.labserver.com
        ServerAlias mysite

        DocumentRoot /var/www/mysite
</VirtualHost>

<VirtualHost *:443>
        ServerName mysite.mylabserver.com
        ServerAlias mysite

        DocumentRoot /var/www/mysite

        SSLEngine on
        SSLCertificateFile /etc/httpd/ssl-certs/apache.crt
        SSLCertificateKeyFile /etc/httpd/ssl-certs/apache.key
</VirtualHost>
Noel Corpse

There is a config file on

/etc/httpd/conf.d is called ssl.conf (or similar)

Keep the default ssl configuration.

Then you have three options...

  1. edit the file
  2. delete the file (not recommended)
  3. Use named virtual hosts.

Remember to copy "listen for 443" to your file.

let me know if it helps

Related


Apache: 2 SSL certificates, same DocumentRoot

Dusty Grist My website is configured apacheand now I'm trying to setup redirects correctly. My website uses wildcard SSL authentication and my ssl certificate covers *.mydomain.com. My certificate provider only covers one level of subdomains. My website URL is

Apache VirtualHost ignored

auto focus I have a web application running fine on apache without any issues. The problem is, now I'm trying to add a new domain for the same app and I can't get it to work . I put two new ServerAlias in my new domain and subdomain, but for some reason it see

apache2 virtualhost configuration with two subdirectories

David Williamson I am running Apache 2.4 on an Ubuntu 14.04 server. The purpose is to use a mail server, so it has postfix, dovecot and roundcube (among other things) on it. I am trying and failing to configure Apache to serve the desired page. I have installe

Apache 2.4 VirtualHost ServerName ignored

StampyCode On Amazon EC2 I have the following configuration: <VirtualHost *:80> ServerName a.example.com ServerRoot /var/www/a.example.com DocumentRoot html </VirtualHost> <VirtualHost *:80> ServerName b.example.com ServerRoot /var

Apache virtualHost is ignored or points to one of the defaults

Alfred Wallace I'm trying to setup my Apache on OSX but can't get the local URL 'awr.local' to point to the correct path. I mean no matter if I enter http://localhost or http://awr.local , it always shows the index.html page in my "localhost" virtual host path

Apache virtualHost is ignored or points to one of the defaults

Alfred Wallace I'm trying to setup my Apache on OSX but can't get the local URL 'awr.local' to point to the correct path. I mean no matter if I enter http://localhost or http://awr.local , it always shows the index.html page in my "localhost" virtual host path

Apache virtualHost is ignored or points to one of the defaults

Alfred Wallace I'm trying to setup my Apache on OSX but can't get the local URL 'awr.local' to point to the correct path. I mean no matter if I enter http://localhost or http://awr.local , it always shows the index.html page in my "localhost" virtual host path

Apache virtualHost is ignored or points to one of the defaults

Alfred Wallace I'm trying to setup my Apache on OSX but can't get the local URL 'awr.local' to point to the correct path. I mean no matter if I enter http://localhost or http://awr.local , it always shows the index.html page in my "localhost" virtual host path

Apache ignores documentroot with multiple SSL domains

Lynxus I'm pulling my hair out here. I have Apache running two different domains using SNI to run SSL. The configuration is as follows. If I connect to console.somedomain.com it puts the user in /var/www/html/ instead of /var/www/html/somedomain/Admin/adminv4/

Apache ignores documentroot with multiple SSL domains

Lynxus I'm pulling my hair out here. I have Apache running two different domains using SNI to run SSL. The configuration is as follows. If I connect to console.somedomain.com it puts the user at /var/www/html/ instead of /var/www/html/somedomain/Admin/adminv4/

Apache ignores documentroot with multiple SSL domains

Lynxus I'm pulling my hair out here. I have Apache running two different domains using SNI to run SSL. The configuration is as follows. If I connect to console.somedomain.com it puts the user at /var/www/html/ instead of /var/www/html/somedomain/Admin/adminv4/

Apache ignores documentroot with multiple SSL domains

Lynxus I'm pulling my hair out here. I have Apache running two different domains using SNI to run SSL. The configuration is as follows. If I connect to console.somedomain.com it puts the user in /var/www/html/ instead of /var/www/html/somedomain/Admin/adminv4/

Unable to access virtualhost on CentOS 6 with Apache 2.2.15

time I've been looking around and trying different configurations of the Apache 2.2.15 server's httpd.conf file, but can't find a solution. So I'm posting it here for Guru's help. I have this configuration in /etc/httpd/conf/httpd.conf on CentOS 6.7 server. Li

Unable to access virtualhost on CentOS 6 with Apache 2.2.15

time I've been looking around and trying different configurations of the Apache 2.2.15 server's httpd.conf file, but can't find a solution. So I'm posting it here for Guru's help. I have this configuration in /etc/httpd/conf/httpd.conf on CentOS 6.7 server. Li

Apache2 wildcard not showing correct DocumentRoot

Quebec For some reason my apache2 server was showing me the contents of another virtual host instead of the wildcard virtual host. When I type hello.purecore.io, the apache2 server will show what is in api.purecore.io and show another folder. The virtualhost c

Apache2 wildcard not showing correct DocumentRoot

Quebec For some reason my apache2 server was showing me the contents of another virtual host instead of the wildcard virtual host. When I type hello.purecore.io, the apache2 server will show what is in api.purecore.io and show another folder. The virtualhost c

Apache2 wildcard not showing correct DocumentRoot

Quebec For some reason my apache2 server was showing me the contents of another virtual host instead of the wildcard virtual host. When I type hello.purecore.io, the apache2 server will show what is in api.purecore.io and show another folder. The virtualhost c

Apache2 wildcard not showing correct DocumentRoot

Quebec For some reason my apache2 server was showing me the contents of another virtual host instead of the wildcard virtual host. When I type hello.purecore.io, the apache2 server will show what is in api.purecore.io and show another folder. The virtualhost c

Apache2 wildcard not showing correct DocumentRoot

Quebec For some reason my apache2 server was showing me the contents of another virtual host instead of the wildcard virtual host. When I type hello.purecore.io, the apache2 server will show what is in api.purecore.io and show another folder. The virtualhost c

Apache2 wildcard not showing correct DocumentRoot

Quebec For some reason my apache2 server was showing me the contents of another virtual host instead of the wildcard virtual host. When I type hello.purecore.io, the apache2 server will show what is in api.purecore.io and show another folder. The virtualhost c

Apache2 VirtualHost go to default directory

Mark Topper I have a default virtual host conf file for apache2 and have copied it to mysite.com.confand changed NameServerand Directory. But when I go to mysite.comstill images does the default directory content show up? Any ideas how to debug this? I am on U

WAMP Apache VirtualHost and Symfony2 issue

Frost I am using WAMP on Windows 7. Every time I try to create a virtual host to use a "clean" URL for a Symfony2 project, I get a 404 error. Here is my httpd.conf: NameVirtualHost localhost <VirtualHost localhost> DocumentRoot "D:/Documents/wamp/"

Apache2 VirtualHost go to default directory

Mark Topper I have a default virtual host conf file for apache2 and have copied it to mysite.com.confand changed NameServerand Directory. But when I go to mysite.comstill images does the default directory content show up? Any ideas how to debug this? I am on U

apache2 VirtualHost on new port not working

Jamsheed Mistri I just installed LAMP on my Ubuntu computer and it works fine when accessing it. I want to add a virtual host on another port (port 1337) that goes to the directory /var/www/flag-1/. For this I take the following steps: cd /etc/apache2/sites-av

WAMP Apache VirtualHost and Symfony2 issue

Frost I am using WAMP on Windows 7. Every time I try to create a virtual host to use a "clean" URL for a Symfony2 project, I get a 404 error. Here is my httpd.conf: NameVirtualHost localhost <VirtualHost localhost> DocumentRoot "D:/Documents/wamp/"

SSL subdomain configuration redirect fails on Apache2

Doodle On my Apache2 server, I have these 3 subdomain sites enabled. database.example.com <VirtualHost *:80> ServerName database.example.com ServerAlias www.database.example.com DocumentRoot /usr/share/phpmyadmin/ Redirect permanent / https://database.