Apache VirtualHost issue

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

Not sure if this shoulld go in this forum, or the programming forum, but my virtual hosts aren't working.
I'm trying to set up a local virtual host for testing purposes. I'd like to use "test.loc" as the address to the website folder.

I set up my host file to include the following line:
Code: [ Select ]
127.0.0.1      test.loc

I uncommented the code in my httpd.conf file:
Code: [ Select ]
Include conf/extra/httpd-vhosts.conf

My vhost.conf file looks like this:
Code: [ Select ]
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
  ServerName localhost
  DocumentRoot "C:/wamp/www"
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot "c:/wamp/www/test"
  ServerName test.loc
  <directory "c:/wamp/www/test">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
  </directory>
</VirtualHost>
  1. NameVirtualHost 127.0.0.1
  2. <VirtualHost 127.0.0.1>
  3.   ServerName localhost
  4.   DocumentRoot "C:/wamp/www"
  5. </VirtualHost>
  6. <VirtualHost *:80>
  7.   DocumentRoot "c:/wamp/www/test"
  8.   ServerName test.loc
  9.   <directory "c:/wamp/www/test">
  10.     Options Indexes FollowSymLinks
  11.     AllowOverride all
  12.     Order Deny,Allow
  13.     Deny from all
  14.     Allow from 127.0.0.1
  15.   </directory>
  16. </VirtualHost>

Not sure why, but test.loc always points to the the php dashboard. I remember setting this up on my other computer some time ago and coming across the same problem, but I don't remember how I fixed the issue. Anyone know?
  • cesaro
  • Novice
  • Novice
  • User avatar
  • Posts: 18
  • Loc: DNSEURO.COM

Post 3+ Months Ago

I think you should try EasyPHP, because it's easy to config your localhost via GUI.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Just out of curiosity, did you restart/reload apache?
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

yep, several times
  • cesaro
  • Novice
  • Novice
  • User avatar
  • Posts: 18
  • Loc: DNSEURO.COM

Post 3+ Months Ago

Try this:
Code: [ Select ]
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1:80>
 ServerName localhost
 DocumentRoot "C:/wamp/www"
</VirtualHost>
<VirtualHost 127.0.0.1:80>
 DocumentRoot "c:/wamp/www/test"
 ServerName test.loc
 <Directory "c:/wamp/www/test">
  Options Indexes FollowSymLinks
  AllowOverride all
  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1
 </Directory>
</VirtualHost>
  1. NameVirtualHost 127.0.0.1
  2. <VirtualHost 127.0.0.1:80>
  3.  ServerName localhost
  4.  DocumentRoot "C:/wamp/www"
  5. </VirtualHost>
  6. <VirtualHost 127.0.0.1:80>
  7.  DocumentRoot "c:/wamp/www/test"
  8.  ServerName test.loc
  9.  <Directory "c:/wamp/www/test">
  10.   Options Indexes FollowSymLinks
  11.   AllowOverride all
  12.   Order Deny,Allow
  13.   Deny from all
  14.   Allow from 127.0.0.1
  15.  </Directory>
  16. </VirtualHost>

and put an index.php into c:/wamp/www/test/
  • Tonzilit
  • Student
  • Student
  • User avatar
  • Posts: 69

Post 3+ Months Ago

Have you already solved your issue?
  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Posts: 854

Post 3+ Months Ago

sort of, ended up uninstalling apache, reinstalling, and then bumping apache down a version from what comes prepackaged with wamp. Seemed to solve the issue.
  • Zealous
  • Guru
  • Guru
  • User avatar
  • Posts: 1244
  • Loc: Sydney

Post 3+ Months Ago

This is why i pay my system administrator ssoo much to take care of the server.

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 6 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.