I have a domain name example.com and a VPS with a static IP address 123.123.123.123.
I want the browsers to provide the domain name to access the website content.
In pratice I want people see my website only if they put exemple.com and not 123.123.123.123 on their browser's url bar.
So in my /var/www/ directory I made two subdirectories.
/var/www/default (for the content that those who do not provide the dn will see)
and /var/www/exemple for the actual website content.
I edited my /etc/apache2/sites-enabled/000-default.conf file like this.
<VirtualHost *:80>
DocumentRoot /var/www/default
</VirtualHost>
<VirtualHost *:80>
ServerName example.com
ServerAlias example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/exemple
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
In my mind this should work. In pratice the server gives me the content of /var/www/default both if i put 123.123.123.123 and exemple.com in my browser's url bar.
Why?