I have setup apache2 to use three domains. They are pointed correctly and I have setup the sites-available config files as the following:
Here is hfd-server.domain1.com, this one displays the default APACHE2 success page. However, it works with www.hfd-server.domain1.com. Don't understand.
<VirtualHost *:80>
ServerAdmin email@domain1.com
ServerName www.hfd-server.domain1.com
DocumentRoot /var/www/hfd-server.domain1.com/public_html
ServerAlias hfd-server.domain1.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Other Directives Here
<Directory /var/www/hfd-server.domain1.com/public_html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Here are the other two working config files:
house.domain1.com
<VirtualHost *:80>
ServerAdmin email@domain1.com
ServerName www.house.domain1.com
DocumentRoot /var/www/house-server.domain1.com/public_html
ServerAlias house.domain1.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Other Directives Here
<Directory /var/www/house.domain1.com/public_html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
house.domain2.com
<VirtualHost *:80>
ServerAdmin email@domain1.com
ServerName www.house.domain2.com
DocumentRoot /var/www/house.domain2.com/public_html
ServerAlias house.domain2.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#Other Directives Here
<Directory /var/www/house.domain2.com/public_html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
The access log and error log shows nothing out of the ordinary. Not sure why one would work but not the other one.
I didn't modify 000-default.conf. I was afraid to, so I made copies and just enabled them.
Is there anything else I can try, HFD-SERVER.domain1.com is linked to a control panel that I would like to have access.
UPDATE 12-28-17
I used sudo apachectl -t -D DUMP_VHOSTS and this is what it listed.
VirtualHost configuration: *:80 is a NameVirtualHost
default server HFD-SERVER.domain1.us (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost hfd-server.domain1.us (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost www.hfd-server.domain1.us (/etc/apache2/sites-enabled/hfd-server.domain1.us.conf:1) alias hfd-server.domain1.us
port 80 namevhost house.domain1.us (/etc/apache2/sites-enabled/house.domain1.us.conf:1) alias www.house.domain1.us
port 80 namevhost house.domain2.us (/etc/apache2/sites-enabled/house.domain2.us.conf:1) alias www.house.domain2.us
Appears that the default server is 000-default.conf. Is there a way to make the hfd-domain1.us.conf the default server?
ServerName hfd-server.domain1.com
andServerAlias www.hfd-server.domain1.com
making the server name without the www and the alias with the www.. for all the entries ... in the sites-enabled folder what entries are in there is it the 000-default.conf along with the 3 new conf files you created? sounds like there is something different about the hfd-server config file .. not really sure what to suggest .. they all end in.conf
. I found apache2 didnt like when I had config files that werent labeled.conf
apachectl -t -D DUMP_VHOSTS
to see if all your virtual hosts are listed