Sample Header Ad - 728x90

Making domain-name only accessible web server with apache2

0 votes
2 answers
1123 views
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. DocumentRoot /var/www/default 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 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?
Asked by Carlo (103 rep)
Mar 22, 2017, 03:41 PM
Last activity: Mar 22, 2017, 04:44 PM