Jump to content
xisto Community

TheGuner

Members
  • Content Count

    7
  • Joined

  • Last visited

Posts posted by TheGuner


  1. How to assign a virtual domain name to your localhost.

    With the help of this tutorial you can assign a virtual domain name to your localhost. That is you can access your local website with your favourite name like http://forums.xisto.com/no_longer_exists/ instead of LOCALHOST and also you can assign different virtual domain names to different local webistes.

     

     

    Requirements:

    1.This tutorial is for Windows. Linux users can also use this, please follow rvalkass's instructions.

     

    2.Apache webserver installed. It would be nice if you have WAMP server. This tutorial is based on WAMP server. But it works on any Apache server with little changes.

     

    Procedure:

     

    part1:

     

    1. First go to location "C:\WINDOWS\system32\drivers\etc" directory.(or where you installed windows). Then open "hosts" file with simple text editor like notepad.

     

    2. You'll see the following code at the end of the file.

    127.0.0.1	  localhost

    In the next line add your virtual domain name like the example shown below.

    127.0.0.1	   mysite.web			  #this is virtual domain name.

    3. Now save the hosts file. mysite.web is just an example. You can add anything like "mywebsite.local" and you can use any extension or no extension at all. You can simply add "mysite" also

     

    4. Now test your virtual domain. Just type http://forums.xisto.com/no_longer_exists/ You must see your wamp page or webservers defalut page. If not you did something wrong. Go through the tutorial carefully.

     

    Note: Don't use any real domain name like Xisto.com or your own domain name if you have any. If you did so, you cannot access the original remote site. This is because, 127.0.0.1 is loopback address, anything with that address will never leave your computer.

     

    Part 2:

    Now second part, assigning virtual domain name to your web site in your webserver.

     

    1. Open your httpd.conf file with Notepad. Click on WAMP icon in the tray, go to Apache menu and select httpd.conf there. You can also open the file by manually go to conf folder in Apache folder.

     

    2. Create a new folder mysite in your C directory. And create a new web page index.html. These are for testing purposes. If you have a local website, specify the full path of website in below code.

     

    3. Now add the following code at the end of the httpd.conf file.

    NameVirtualHost 127.0.0.1  <VirtualHost 127.0.0.1>		ServerName localhost		DocumentRoot "C:/wamp/www"			#this is default wamp root for websites </VirtualHost>  <VirtualHost 127.0.0.1>	 ServerName mysite.web			#your virtual domain name	 DocumentRoot "C:/mysite"		#location of your site, no extenison needed #the following are security settings, allow you to access directory outside the www directory				<Directory C:/mysite>			#again location of your website			Order Allow,Deny		   Allow from all				</Directory> </VirtualHost>
    Save httpd.conf file. Restart your WAMP server. now type http://forums.xisto.com/no_longer_exists/. You'll see the index page of mysite.

     

    Adding Another Virtual Domain and Website:

     

    If you want another website, first add another virtual domain in hosts file as shown in part1.

    And then copy and paste the following code at the end of httpd.conf file. Just change the virtual domain name, and locations of website.

     

    <VirtualHost 127.0.0.1>	 ServerName mywebsite.web			#change this virtual domain name	 DocumentRoot "C:/mywebsite"			#location of your site, change this.		<Directory C:/mywebsite>			#again location of your website, change this				   Order Allow,Deny				   Allow from all		</Directory> </VirtualHost>
    You can add as many websites as you wish. Just repeat the above procedure.

     

    IF you have any doubts about this tutorial, post them here.


    Thanks for this nice sharing can you plz also teach how to use SMTP service??

     

    Thanks,

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.