Issue
Well, I am new on Debian, Built server on Digital Ocean with Debian OS. I successfully added two domains into one droplet:
mysite.com
anothersite.com
Created new dir:
/home/user/www/mysite.com/public_html
and copied files to public_html
The config file inside /etc/apache2/sites-available
is:
DocumentRoot /home/user/www/mysite.com/public_html
<Directory /home/user/www/mysite.com/public_html>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/myproject-error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/myproject-access.log combined
Of Course, I enabled the site.
I haven't edited apache2.conf
file and haven't configured 2nd domain (anothersite.com
). Just added this 2nd domain to droplet, that's all.
when I enter to the site mysite.com
it works perfect. But I wondered that why 2nd domain (anothersite.com
) is redirected to 1st (mysite.com
) domain?
By the way, I use Apache 2.4
Solution
If hostname (e.g. anothersite.com) point to the apache webserver but haven't explicitely configured a section that matches that hostname, then apache will deliver a "best match" (the first ).
so if only have a single in apache config and multiple hostnames (mysite.com and anothersite.com) point to the same machine, all of these names will display the same virtual host
Answered By - Rashad