Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I was working with localhost:81 during a long time with vhost and all was right. Right now I need to work over the 80 port and i change the http.conf and http-vhost for used the 80 port but right now into the browser localhost works ok, 127.0.0.1 and the vhost not find the server.

my configurations are: * My local machine is lion osx * mamp * HTTP.conf:

 ServerName localhost:80

* http-vhost NameVirtualHost localhost

 <VirtualHost localhost>
   DocumentRoot "/Users/chalien/projects/ownProjects/PHP"
   ServerName example.dev
 </VirtualHost>

* /private/etc/hosts

 127.0.0.1  localhost
 255.255.255.255    broadcasthost
 ::1             localhost
 fe80::1%lo0    localhost
 127.0.0.1      example.dev

* /private/etc/services

  http             80/udp     www www-http # World Wide Web HTTP
  http             80/tcp     www www-http # World Wide Web HTTP
share|improve this question

migrated from stackoverflow.com Sep 22 '12 at 20:04

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

up vote 1 down vote accepted

The whole point of virtual hosts is that they're used when multiple names point to the same address. So it won't be used when someone connects to the address directly. You need to add:

<VirtualHost 127.0.0.1>
  ...
</VirtualHost>

Also, in /etc/hosts you shouldn't have multiple lines with the same IP, you should combine them:

127.0.0.1   localhost example.dev
share|improve this answer
    
i did it and works in part. right no with the vhost in the same line in hosts file my vhost show the serverroot but not the defined into the virtualhost tag –  Charly Palencia Sep 22 '12 at 2:18
    
ThAKS SO MUCH YOU HELP ME!! THANKS!! –  Charly Palencia Sep 22 '12 at 2:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.