Two Domains and two Apache2.4 Vhosts

Hi,
I have two domains and they are all under CF service.
I have configured two vhosts on one VPS, they have different root directories. I want my two domain names to be able to access two vhosts respectively. However, they all point to the root directory of the first vhost.
In fact, no matter which domain name I visit, I will enter /var/www/html
I don’t know if it’s my configuration problem.
I‘d be grateful if you would help.

My file 000-default.conf is as follows:

<VirtualHost *:80>
	ServerName Mydomain1.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	<Directory "/var/www/html">
	AllowOverride ALL
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

<VirtualHost *:8082>
	ServerName Mydomain2.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/tools

	<Directory "/var/www/tools">
	AllowOverride ALL
	</Directory>
	
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Afraid, server configuration is beyond the scope of the forum and needs to be discussed in a more appropriate forum.

However, your configuration does not have any SSL configuration. That’s definitely an issue.

Essentially, make sure your site loads fine on HTTPS without Cloudflare and it will work on Cloudflare as well.

This topic was automatically closed 2 hours after the last reply. New replies are no longer allowed.