Skip to main content

How to Create Fake Domain Name on Localhost

 The purpose of this tutorial is to create fake domain name on localhost, i.e. you are running your local website online:

1. Create folder which will serve as your Web applications directory. You can place Web applications as many as you want in this folder. In my case:

C:/workspace/www

2. Suppose I want to develop my Web application or website whose domain is j2technologies.com, then I'll create folder inside the above-created working directory and name it:

j2technologies.com

Hence, C:/workspace/www/j2technologies.com.



3. I will now create 2 new folders inside j2technologies.com folder:

conf
public_html

conf is where configuration will be placed and public_html is where web documents will be placed. Index file, either index.html or index.php, should be on top of public_html.

Hence, C:/workspace/www/j2technologies.com/conf and C:/workspace/www/j2technologies.com/public_html.

4. You should place or extract (like joomla, wordpress, phpbb, drupal, etc) your web files on top of public_html, i.e. index file should be in public_html.

5. Open your favorite text editor. I suggest Notepad. Type in the following and save as conf.conf (not .txt) inside folder conf:

<VirtualHost *:80>   
    ServerAdmin admin@j2technologies.com
    DocumentRoot "C:/workspace/www/j2technologies.com/public_html"
    ServerName j2technologies.com
    ServerAlias www.j2technologies.com
    ErrorLog "logs/j2technologies.com-error.log"
    CustomLog "logs/j2technologies.com-access.log" common
    <Directory "C:/workspace/www/j2technologies.com/public_html">
        Order Deny,Allow
        Allow from all
    </Directory>
</VirtualHost>

6. Open Apache httpd.conf configuration. At the last line add the following:

NameVirtualHost *:80

7. Then add also the following:

Include "C:/workspace/www/j2technologies.com/conf/conf.conf"

Save and close Apache httpd.conf configuration.

8. Open hosts file in Notepad. hosts file is located at C:\Windows\System32\drivers\etc. Yes, it does not have extension. At the last line, type in the following:

127.0.0.1    j2technologies.com
127.0.0.1    www.j2technologies.com

If this file is edited for the first time, you may save it first in Desktop with the same name without extension, hosts. Then copy this to C:\Windows\System32\drivers\etc to overwrite existing hosts file.

8. Restart Apache. You should be able to open your site with www.j2technologies.com or j2technologies.com.

Download PDF file.

Thanks. Suggestions and comments are highly appreciated.

Comments

Popular posts from this blog

Guestbook in PHP and MySQL

Introduction I'm going to create an example of guestbook system using in PHP and MySQL. On the Web, guestbook is a logging system that lets visitor post their message. A visitor can post their thoughts or expressions. In general, it's not a requirement that a visitor create an account.

Phonebook Application with PHP and MySQL CRUD Operation

Definition It is a simple Web-based phonebook application which stores and displays ID, Name, Contact No, and Address of a person. It is also capable of updating/editing and deleting phonebook entries. Database CREATE TABLE `phonebook` (     `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,     `name` VARCHAR(50) NOT NULL,     `phone_no` VARCHAR(15) NOT NULL,     `address` VARCHAR(50) NOT NULL,     `date_created DATETIME` NOT NULL DEFAULT ‘0000-00-00 00:00:00’,     PRIMARY KEY(`id`) );

CRUD in Spring Boot with Spring Data JPA

T utorial about CRUD operations in Spring Boot with Spring Data JPA. Application developed in this tutorial performs adding, editing, updating and deleting contacts. Continue reading here .