Hey.
When you setup an Apache Web Server, what is the default directory that can be accessed with just the IP Address and how do you manage/change the default?
For a scenario when there are multiple websites on a single Web Server (which is managed by CPanel) one should prefer a dedicated IP or prefer a shared IP for allowing each of those websites to seperate Domain Names? And how would you manage the assigning of the each website’s DNS records?
Thank you!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
You would need to setup whats known as Virtual Hosts in your Apache config. There is a good walk through here for Ubuntu 16.04, The process is fairly similar in every distribution.
In the Create the First Virtual Host File section shows you how to set this up in the file
/etc/apache2/sites-available/default.conf
as shown belowThis example accepts all traffic for port 80 and sends it to
/var/www/html
. This includes all unassigned IP addresses and domains.To add an assigned domain you would create a file
/etc/apache2/sites-available/domain.com.conf
and enter the below configuration.Repeating this for each domain/ip and adjusting the values in red.
You will following the remaining steps in the above link to enable these configurations.