Jump to content


Photo

Virtual host


  • Please log in to reply
8 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 18 August 2006 - 12:54 PM

Hey

This is strange

I am using Uniform server as my localhost
This uses Apache 2, php 5....

I am trying to set up a Virtual host
I started with adding this into the httpd.conf file

<VirtualHost>
DocumentRoot /www/game
Servername game.localhost
</VirtualHost>

And uncommented
NameVirtualHost *

ok

I went to game.localhost
and it goes to www root, not www/game

I also tried mygame

I deleted uniform server and re-installed it

Now
I set up game again
Still the same
BUT
mygame is still working (well going to www root)
Although
mygame is not ANYWHERE in the config file, its a clean install

so my 2 questions

one
WTF is going on with mygame virtual host, it dont exsist but it works?

2
How do I set up a virtual host to go to the folder www/game
or better
C:/game

(With Uniform Server, it created a Virtual Drive called W:/, so the full root is W:/www/)

HELP me please
Tell me the problem, I will try tell you the solution

#2 oldmanice

oldmanice
  • Members
  • PipPipPip
  • Advanced Member
  • 134 posts
  • LocationIn Your Garden At Night

Posted 04 September 2006 - 10:03 PM

I think you could try to put those folders where you want it to appear. And it may appear because you havent deleted your Cache files
Join my Froums www.phpbbplanet.com/darkwinter

#3 R_P

R_P
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 05 September 2006 - 03:01 PM

oldmanice, stop spamming the apache forums, I don't think you've really helped anyone.

Take a look at this link:
http://httpd.apache....name-based.html

First off, you aren't using the wildcard in your virtual host directive (<VirtualHost *:80>). Also, when using name-based virtual hosting, a virtual host needs to be created for your original name and documentroot. The virtual hosts will inherit all other settings from the parent directives.

Make sure you are restarting your server everytime you make a change to the httpd config file.

I've never tested sub-domains on the localhost, but I guess if the URI isn't throwing errors that it works. You might also want to add an alias to the VH, something like this:

<VirtualHost *:80>
ServerName game.localhost
ServerAlias game.127.0.0.1  # Not sure if this would work
DocumentRoot /www/game
</VirtualHost>

Good Luck, hope this helps.
Pro in: Win2K3S | Apache2 | PHP5 | Perl5 | MySQL | MSSQL | Firefox | Photoshop
Student of: Ubuntu6 | Java | C | VB.NET | ASP.NET
Developer: Roddzilla Webstudios, Burrson CG, DVIDSHUB, The Four Nations
Student: Georgia Tech, Georgia Tech College of Computing

#4 oldmanice

oldmanice
  • Members
  • PipPipPip
  • Advanced Member
  • 134 posts
  • LocationIn Your Garden At Night

Posted 05 September 2006 - 07:52 PM

R_P I have helped people Look at the post Unable to access outside local machine. Man chill out


Join my Froums www.phpbbplanet.com/darkwinter

#5 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 05 September 2006 - 11:12 PM

I think you could try to put those folders where you want it to appear. And it may appear because you havent deleted your Cache files


Read:
I deleted the localhost server, (including apache)

Deleted Cache cookies the works

and yes, I did try to enter files into the folder,
going to that address would always go to the root of the site, not the folder.

oldmanice, stop spamming the apache forums, I don't think you've really helped anyone.

Take a look at this link:
http://httpd.apache....name-based.html

First off, you aren't using the wildcard in your virtual host directive (<VirtualHost *:80>). Also, when using name-based virtual hosting, a virtual host needs to be created for your original name and documentroot. The virtual hosts will inherit all other settings from the parent directives.

Make sure you are restarting your server everytime you make a change to the httpd config file.

I've never tested sub-domains on the localhost, but I guess if the URI isn't throwing errors that it works. You might also want to add an alias to the VH, something like this:

<VirtualHost *:80>
ServerName game.localhost
ServerAlias game.127.0.0.1  # Not sure if this would work
DocumentRoot /www/game
</VirtualHost>

Good Luck, hope this helps.


I am not bothered about the sub domain
I saw my friend do it that way, so I was trying that

I will look at the link tomorrow, (if I have 5 mins)
Thanks
Tell me the problem, I will try tell you the solution

#6 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 06 September 2006 - 07:13 AM

I have added this code
NameVirtualHost *

<VirtualHost *:80>
ServerName game.localhost
ServerAlias game.127.0.0.1
DocumentRoot /www/game
</VirtualHost>

I created a folder in /www called "game"

I put an index.php file in there

Restarted Apache 2.0

Went to
game.localhost

and it comes up with the directory of www/

So no joy

I have tried changing
DocumentRoot /www/game
to
DocumentRoot /www/game/

but the same thing happens


Tell me the problem, I will try tell you the solution

#7 R_P

R_P
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 06 September 2006 - 10:43 PM

try adding both (create a virtual host also for your original server name. Again, I've never seen a sub-domain construct work on a localhost. For me your breaking new territory. Good Luck.


<VirtualHost *:80>
   ServerName localhost
   ServerAlias 127.0.0.1
   DocumentRoot /www/
</VirtualHost>

<VirtualHost *:80>
   ServerName game.localhost
   ServerAlias game.127.0.0.1
   DocumentRoot /www/game/
</VirtualHost>


Pro in: Win2K3S | Apache2 | PHP5 | Perl5 | MySQL | MSSQL | Firefox | Photoshop
Student of: Ubuntu6 | Java | C | VB.NET | ASP.NET
Developer: Roddzilla Webstudios, Burrson CG, DVIDSHUB, The Four Nations
Student: Georgia Tech, Georgia Tech College of Computing

#8 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 08 September 2006 - 12:04 PM

I found out why although I deleted apache, the virtual host names are still working
I am using Windows
In the folder
C:\WINDOWS\system32\drivers\etc
There is a file called
hosts (no extension)

This is the file where the info is stored


Tell me the problem, I will try tell you the solution

#9 R_P

R_P
  • Members
  • PipPipPip
  • Advanced Member
  • 98 posts

Posted 08 September 2006 - 04:09 PM

See, I'm still not sure if using subdomains on localhost is breaking the protocol. Either way, the host file should already contain the entry:

127.0.0.1    localhost

Maybe you may want to try:

127.0.0.1    game.localhost

Keep in mind that if you go public with the server, you create subdomains at the DNS level, and manage them at the apache level - you won't need to modify the host file, ever. Glad you gained some ground. Keep on truckin.
Pro in: Win2K3S | Apache2 | PHP5 | Perl5 | MySQL | MSSQL | Firefox | Photoshop
Student of: Ubuntu6 | Java | C | VB.NET | ASP.NET
Developer: Roddzilla Webstudios, Burrson CG, DVIDSHUB, The Four Nations
Student: Georgia Tech, Georgia Tech College of Computing




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users