Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

How To Assign A Virtual Domain Name To Your Localhost.


34 replies to this topic

#31 Guest_RanZo - Mega Czar_*

  • Guests

Posted 19 December 2010 - 01:36 PM

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 name
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 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?

#32 Guest_webomat_*

  • Guests

Posted 07 July 2011 - 09:40 AM

View PostRanZo - Mega Czar, on 19 December 2010 - 01:36 PM, said:

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.infinited...rg/archives/217

works for me very well.

#33 Guest_sreenath@alex_*

  • Guests

Posted 05 December 2011 - 04:28 AM

View Postxpress, on 07 December 2008 - 01:24 AM, said:

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://mysite.web instead of http://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://mysite.web 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 trap17.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://mysite.web. 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 http://www.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..

#34 Guest_Mahendra_*

  • Guests

Posted 06 February 2012 - 01:25 AM

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".

#35 Guest_mital_*

  • Guests

Posted 13 February 2012 - 10:28 AM

After modify httpd.conf file, my apache server will not start, give me solution




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users