Forum Moderators: phranque

Message Too Old, No Replies

local vhosts for testing

         

jamie

2:22 pm on Oct 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

i've just set up apache on a mac for testing. i have can connect to the mac (having edited my vista hosts file) and can access my test sites perfectly over the network from vista, using the local names devsite.one, devsite.two, etc

however when i try to browse the same sites from the mac itself, apache is painfully slow.

my /etc/hosts looks like this:

127.0.0.1 localhost devsite.one devsite.two


i can browse
devsite.one
very quickly, but
devsite.two
is like a snail and only loads after a minute or so. i have tried changing the order in /etc/hosts, but this doens't make a difference.

apache listens on 127.0.0.1 and 192.168.0.37 (my mac static ip)

my VirtualHost containers are

<Virtual Host *:80>
ServerName devsite.one
DocRoot /my/doc/root
</VirtualHost>


i can ping
devsite.two
from the mac instantaneously.

HostnameLookups
are Off

this sort of setup has worked fine on other *nix boxes.

can anyone suggest something i've overlooked?

many thanks

jamie

2:58 pm on Oct 7, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



problem solved. nothing to do with apache. i tracked it down to calling session_start() in that vhost

it had to do with the session.save_path. i set that in php.ini to /tmp and all vhosts are working fine.

don't really understand why, as i use session_start() in all vhosts.

cheers anyway

jamie

11:53 am on Oct 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



just a quick update, it wasn't the session save path at all, it was the /etc/hosts file.

i had it like this:

127.0.0.1 localhost devsite.one devsite.two devsite.three devsite.four (with 10 further local sites)

moving each of these hosts on to their own line fixed the problem:

127.0.0.1 localhost
127.0.0.1 devsite.one
127.0.0.1 devsite.two

etc, etc.

i couldn't find anything on the web to confirm or deny this, but maybe it helps someone in the future.

cheers

sublime1

6:50 pm on Oct 9, 2010 (gmt 0)

10+ Year Member



Hmm, I have multiple hosts listed on a single line as localhost in /etc/hosts on my mac, and they work fine. I can confirm the local resolution using ping on the name.

Anything after the first entry is said to be an alias (kind of a CNAME, I guess?). The HOSTS(5) man page didn't indicate any length limitation. Perhaps a stray character got in there?

In any case, it's probably academic, since your solution also works :-)