Apache Virtual Host Setup
Learn how to set up a virtual host in an Apache-like server and in GNU/Linux.
We'll cover the following...
Setting up a web server like Apache gives us only one domain, which is http://localhost
. This domain is associated with the 127.0.0.1
IP address.
One host per server —localhost
As we stated above, we are only allowed to have on the website by a web server. To get around this limitation, we’ll create different directories, each for one website on the localhost:
http://localhost/time-tracker
http://localhost/smartsapp
We have two directories in http://localhost
. We can add as many as we want.
Although this solution is helpful it has its own issues as well:
- It does not reflect the reality of the production server, where each site has its own domain (
http://time-tracker.com
). - We may encounter issues with relative paths.
To avoid issues in a production server, it would be better if we have a local environment ...