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

Yeah, that is exactly what I meant but I am using EasyPHP and I can't find the file you specify. I am using Vista and I need to give it Admin control to be able to put a file in the testing servers folder. What would the variation be for EasyPHP or should it be the same?

Share this post


Link to post
Share on other sites

Yeah, that is exactly what I meant but I am using EasyPHP and I can't find the file you specify. I am using Vista and I need to give it Admin control to be able to put a file in the testing servers folder. What would the variation be for EasyPHP or should it be the same?

Sorry yaar, I don't have Vista to test EasyPHP on it. But I will download EasyPHP and try it on my XP system and post the result here. In the mean time try to find httpd.conf file and change it as per the second part. Anc check whether it is working or not...

Share this post


Link to post
Share on other sites
how to create a domain name that links back to localhostHow To Assign A Virtual Domain Name To Your Localhost.

I was wondering if you could do this is IIS, there is a host file in system32, but if I edit that, it only works for the edited host file.

 eg 

computer 1 with edited host file

<external ip> https://www.website.com/ - links to localhost, but external ip.

computer 2 - non edited host file

https://www.website.com/ - doesnt work, because host file isnt edited.

hope you get my drift of what I'm trying to acheive.

thanks

 

-reply by robertKeywords: how to create a domain name that links back to localhost

Share this post


Link to post
Share on other sites
Input on usesHow To Assign A Virtual Domain Name To Your Localhost.

Just a reply on who commented that it's not very useful, I'm masking my files in the URL, so I need to have a virtual domain for something like "http://forums.xisto.com/no_longer_exists/; to work

 LOCALHOST/someSite/Home won't work.

-reply by Astral Axiom

 

Share this post


Link to post
Share on other sites
Noob has problemsHow To Assign A Virtual Domain Name To Your Localhost.

I have run through your very well written process. Doing so crashes apache.

I am using xampp 1.7 on ubuntu hardy 8.1 

The only difference is that httpd.Conf in my version has a "include httpd-vhosts.Conf file line. 

If I put the virtual name code there I get 403 code forbidden. Does not matter if I change or block permissions.

Is there somewhere else on httpd.Conf that I can change permissions. The only line I see is already set for all. 

Just learning so if it is obvious please be kind.  :)

-reply by Todd

 

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  <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,

Share this post


Link to post
Share on other sites
For http://forums.xisto.com/no_longer_exists/ use ServerAliasHow To Assign A Virtual Domain Name To Your Localhost.

I was searching for this today so others might find it helpful too... If you also want to also have http://forums.xisto.com/no_longer_exists/ you can use ServerAlias, just under 'ServerName' like this:

 <VirtualHost 127.0.0.1> ServerName mywebsite.Web #change this virtual domain name ServerAlias *.Mywebsite.Web #change this virtual domain name

That way, you can type http://forums.xisto.com/no_longer_exists/ or http://forums.xisto.com/no_longer_exists/ or indeed http://forums.xisto.com/no_longer_exists/ and still be able to see your site.

By the way, instead of .Web, I like to use .Loc to signify that it's a local copy.

-Ian

Share this post


Link to post
Share on other sites
localhost to mysiteHow To Assign A Virtual Domain Name To Your Localhost.

I am following all the steps 

I am changing the localhost to mysite into the hosts file.Still I am not gettting the webserver page 

I am using windows 7 ultimate 

is there any problem 

-reply by vivek

Share this post


Link to post
Share on other sites
Doing this in Ubuntu got a problemHow To Assign A Virtual Domain Name To Your Localhost.

I'm using Ubuntu 9.04 and I'm running LAMP server. I installed it through my terminal and I didn't have to configure anything. But the problem is when I see my httpd.Conf file which locate /etc/apache2/ there is nothing. 

cat /etc/apache2/httpd.Conf

But my localhost running perfectly okey and I'm running some websites also in there. The strange thing is I can't find any other httpd.Conf file in my hard drive. 

find / -name httpd.Conf

I'm totally confused. Have someone got any idea.

-reply by anuja

Share this post


Link to post
Share on other sites
Having problemHow To Assign A Virtual Domain Name To Your Localhost.

xpress nice tut dude

I have done both part on xampp and wamp having same problem with both software that I can access http://forums.xisto.com/no_longer_exists/ but if I edit httpd.Conf and put that xml codes then apache will not start on both software (I checked one by one) then I edit httpd.Conf again I remove xml codes then apache runs on both software. So can u Please help me on that I don't know y its happen although I reinstall both software again and again.

 

thnx and advance

take care

-reply by Areenshah

Share this post


Link to post
Share on other sites
How To Assign A Virtual Domain Name To Your Localhost.How To Assign A Virtual Domain Name To Your Localhost.

Very useful information!

Thanks!

-reply by Tom Carnevale

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.