I have configured multiple virtual hosts in Centos 7 with the configuration files located in /etc/httpd/sites-available/ directory with configuration files for each subdomain as:
xxa.domain.com,
xxb.domain.com,
xxc.domain.com etc.
The web folder for each subdomain is located at:
/var/www/xxa.domain.com/public_html
/var/www/xba.domain.com/public_html
/var/www/xxc.domain.com/public_html
I have a difault index.html page in each ‘public_html’ folder to test the web site is working ok.
The virtual host configuration files for each of these subdomains are located at:
/etc/httpd/sites-enabled/xxa.domain.com.conf
/etc/httpd/sites-enabled/xxb.domain.com.conf etc.
I was able to view the default page for each subdomain as http domain.
After a number of attempts, I managed to successfully generate and installed Letsencrypt certificate one for each subdomain. I have also configured under ‘non-ssl.conf’ file located under /etc/httpd/conf.d/ to forward port 80 to port 443.
<VirtualHost :80>
** ServerName xxa.domain.com*
** Redirect “/” “https://xxa.domain.com/”**
This redirection also works fine.
However when I visit the url ‘https://xxa.domain.com’ it displays a common apache default web page. The same page is displayed under all other subdomains.
On the default apache web page the following instruction is displayed:
Are you the Administrator?
You should add your website content to the directory /var/www/html/.
To prevent this page from ever being used, follow the instructions in the file /etc/httpd/conf.d/welcome.conf.
Need advise on where I should change the configuration for each of these subdomains to use the web folder already configured rather than go to one single folder ‘/var/www’
I need each https subdomain to use the web folder such as:
https://xxa.domain.com > > /var/www/xxa.domain.com/public_html
https://xxb.domain.com > > /var/www/xxb.domain.com/public_html
https://xxc.domain.com > > /var/www/xxc.domain.com/public_html
While generating the cert, I also observed the following status change:
"Redirecting vhost in /etc/httpd/sites-enabled/xxa.domain.com.conf to ssl vhost in /etc/httpd/conf.d/non-ssl-le-ssl.conf"
I am at a loss to know how to use Letsencrypt Cert and configure to use the web folders already configured and not change it.
Looking forward to receiving some advise on how to achieve this.
Festus