Jump to content
xisto Community
xpress

How To Assign A Virtual Domain Name To Your Localhost. Assigning virtual domain names and websites to your localhost.

Recommended Posts

Thanks for sharing your knowledge with us.I realy need something like this for magento cms.I completed first part fine.However pasting this code to httpd.cofig stops the wamp server from working.#my addition for virtual domain nameNameVirtualHost 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 testmagento.com #your virtual domain name DocumentRoot "C:/testmagento" #location of your site, no extenison needed#the following are security settings, allow you to access directory outside the www directory <Directory C:/testmagneto> #again location of your website Order Allow,Deny Allow from all </Directory></VirtualHost>Can you help?

Share this post


Link to post
Share on other sites

Thanks for sharing your knowledge with us.I realy need something like this for magento cms.
I completed first part fine.
However pasting this code to httpd.cofig stops the wamp server from working.


Can you help?


I have the same problem.
Changing conf\extra\httpd-vhosts.conf in the way described here:

http://www.infinitedesigns.org/archives/217

works for me very well.

Share this post


Link to post
Share on other sites

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  ServerName localhost DocumentRoot "C:/wamp/www" #this is default wamp root for websites   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  #again location of your website Order Allow,Deny Allow from all
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.
ServerName mywebsite.web #change this virtual domain name DocumentRoot "C:/mywebsite" #location of your site, change this.  #again location of your website, change this Order Allow,Deny Allow from all
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.

 

 

hey it's gave me an error in first part .... like this

 

 

 

root@alex:/home/sreenath# sudo /opt/lampp/lampp restart

sudo: unable to resolve host alex

Stopping XAMPP for Linux 1.7.7...

XAMPP: XAMPP-Apache is not running.

XAMPP: Stopping MySQL...

XAMPP: XAMPP-ProFTPD is not running.

XAMPP stopped.

Starting XAMPP for Linux 1.7.7...

XAMPP: Starting Apache with SSL (and PHP5)...

XAMPP: Error 1! Couldn't start Apache!

XAMPP: Starting diagnose...

XAMPP: Sorry, I've no idea what's going wrong.

XAMPP: Please contact our forum https://community.apachefriends.org/f/

XAMPP: Starting MySQL...

XAMPP: Starting ProFTPD...

XAMPP: - warning: unable to determine IP address of 'alex'

- error: no valid servers configured

- Fatal: error processing configuration file '/opt/lampp/etc/proftpd.conf'

XAMPP: Error 1! Couln't start ProFTPD!

XAMPP for Linux started.

 

 

 

plz help me .... thanx in advance..

Share this post


Link to post
Share on other sites

Hi Guys,A small correction in Part2:Instead of Editing "httpd.conf" for creating virtual host, just edit the file "httpd-vhosts.conf" it is easy and simple.I'm using lampp on Linux, so you can find httpd-vhosts.conf at "/opt/lampp/etc/extra".

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • 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.