Apache – Use a custom domain name instead of localhost

|
| By Webner

By following these steps you can run your local machine’s website using a custom domain name instead of localhost:

1. Edit apache configuration file:

sudo gedit /etc/apache2/sites-available/000-default.conf

 

add ServerName property as follows (you can add it just below DocumentRoot, make sure DocumentRoot is pointing to your web project’s root folder ):

ServerName your_domain_name.com

Use domain url of your choice instead of your_domain_name.com

2. Edit /etc/hosts file:

sudo gedit /etc/hosts
and enter following statement in it:

127.0.0.1 your_domain_name.com

3. Restart apache:

sudo /etc/init.d/apache2 restart

Webner Solutions is a Software Development company focused on developing websites, mobile apps and CRM apps. If you need any assistance please contact us at webdevelopment@webners.com.

Leave a Reply

Your email address will not be published. Required fields are marked *