Uncategorized

Configuring a Virtual Host on Apache to Map local.devserver.com to localhost on Ubuntu

Pinterest LinkedIn Tumblr

To add local.devserver.com to your /etc/hosts file while keeping the existing entries, you can edit the file as follows:

  1. Open the /etc/hosts file with a text editor:
sudo nano /etc/hosts
  1. Add the following line to map local.devserver.com to localhost:
127.0.0.1       local.devserver.com

Your /etc/hosts file should now look something like this:

127.0.0.1       localhost

# The following lines are desirable for IPv6 capable hosts
::1             ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.0.1       local.devserver.com

Save and Exit

  • Press Ctrl + O to save the file.
  • Press Enter to confirm.
  • Press Ctrl + X to exit the editor.

Verify

After editing the /etc/hosts file, you can verify that local.devserver.com correctly resolves to 127.0.0.1:

ping local.devserver.com

You should see output indicating that local.pref.com is resolving to 127.0.0.1.

Restart Apache

If you haven’t already, restart Apache to ensure it picks up the new virtual host configuration:

sudo systemctl restart apache2

Now you should be able to access your application at http://local.devserver.com:4200/, and it will be proxied to http://localhost:4200/signin.

If you encounter any issues or need further assistance, feel free to ask!

Write A Comment