onlyican Posted August 18, 2006 Share Posted August 18, 2006 HeyThis is strangeI am using Uniform server as my localhostThis uses Apache 2, php 5....I am trying to set up a Virtual hostI started with adding this into the httpd.conf file<VirtualHost>DocumentRoot /www/gameServername game.localhost</VirtualHost>And uncommentedNameVirtualHost *okI went to game.localhostand it goes to www root, not www/gameI also tried mygameI deleted uniform server and re-installed itNowI set up game againStill the sameBUTmygame is still working (well going to www root)Although mygame is not ANYWHERE in the config file, its a clean installso my 2 questionsoneWTF is going on with mygame virtual host, it dont exsist but it works?2How do I set up a virtual host to go to the folder www/gameor betterC:/game(With Uniform Server, it created a Virtual Drive called W:/, so the full root is W:/www/)HELP me please Quote Link to comment Share on other sites More sharing options...
oldmanice Posted September 4, 2006 Share Posted September 4, 2006 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 Quote Link to comment Share on other sites More sharing options...
R_P Posted September 5, 2006 Share Posted September 5, 2006 oldmanice, stop spamming the apache forums, I don't think you've really helped anyone.Take a look at this link:http://httpd.apache.org/docs/2.0/vhosts/name-based.htmlFirst 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.localhostServerAlias game.127.0.0.1 # Not sure if this would workDocumentRoot /www/game</VirtualHost>Good Luck, hope this helps. Quote Link to comment Share on other sites More sharing options...
oldmanice Posted September 5, 2006 Share Posted September 5, 2006 R_P I have helped people Look at the post Unable to access outside local machine. Man chill out Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 5, 2006 Author Share Posted September 5, 2006 [quote author=oldmanice link=topic=104744.msg428055#msg428055 date=1157407417]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[/quote]Read:I deleted the localhost server, (including apache)Deleted Cache cookies the worksand 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.[quote author=R_P link=topic=104744.msg428480#msg428480 date=1157468480]oldmanice, stop spamming the apache forums, I don't think you've really helped anyone.Take a look at this link:http://httpd.apache.org/docs/2.0/vhosts/name-based.htmlFirst 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.localhostServerAlias game.127.0.0.1 # Not sure if this would workDocumentRoot /www/game</VirtualHost>Good Luck, hope this helps.[/quote]I am not bothered about the sub domainI saw my friend do it that way, so I was trying thatI will look at the link tomorrow, (if I have 5 mins)Thanks Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 6, 2006 Author Share Posted September 6, 2006 I have added this code[code]NameVirtualHost *<VirtualHost *:80>ServerName game.localhostServerAlias game.127.0.0.1DocumentRoot /www/game</VirtualHost>[/code]I created a folder in /www called "game"I put an index.php file in thereRestarted Apache 2.0Went togame.localhostand it comes up with the directory of www/So no joyI have tried changingDocumentRoot /www/gametoDocumentRoot /www/game/but the same thing happens Quote Link to comment Share on other sites More sharing options...
R_P Posted September 6, 2006 Share Posted September 6, 2006 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.[code]<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>[/code] Quote Link to comment Share on other sites More sharing options...
onlyican Posted September 8, 2006 Author Share Posted September 8, 2006 I found out why although I deleted apache, the virtual host names are still workingI am using WindowsIn the folderC:\WINDOWS\system32\drivers\etcThere is a file calledhosts (no extension)This is the file where the info is stored Quote Link to comment Share on other sites More sharing options...
R_P Posted September 8, 2006 Share Posted September 8, 2006 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 localhostMaybe you may want to try:127.0.0.1 game.localhostKeep 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.