NYCPHP Meetup

NYPHP.org

[nycphp-talk] Apache config question

Marc Antony Vose suzerain at suzerain.com
Sat Sep 6 07:54:33 EDT 2003


I have several dummy domains set up on my machine.  I think your 
problem is that you're missing the first VirtualHost directive, which 
is the base one for the server (where the "Hey, your Apache install 
worked" page ends up).

Then, you can append the other virtual hosts.

And. here's my relevant snippet from httpd.conf:

---
<VirtualHost 127.0.0.1>
ServerName 127.0.0.1
DocumentRoot /Library/WebServer/Documents
</VirtualHost>

Include /private/etc/httpd/vhosts
---

That first virtual host needs to be declared and then your others are 
handled separately.


So, inside the vhosts directory, I have several text files, each 
containing a virtual host directive.  Here's one:

<VirtualHost 127.0.0.1>
ServerName www.clientname.me
DocumentRoot /Library/WebServer/Documents/clientname
</VirtualHost>

They all have different directories.

(These are from dummy domains that I set up on my laptop to mirror my 
client's real ones, but in principle they work exactly the same with 
a server that's serving to other machines.)

Just make sure the other machines know where to go to see www.testserver.com.

Hope that helps.  I am by no means an Apache server admin, but this 
works for me.

Marc



>I'm not sure how to handle this. I'm setting up a new server at the
>office. I'd like to be able to set up a directory structure like this:
>
>	/var/www/html/clientproj1  <= for client stuff
>	/var/www/html/myproj <= for whatever other project I may work on
>
>I started effing around with virtual host (see below) which works fine
>for this one instance but it's not obvious how to set up another virtual
>host since I really don't have "names" for each one. I access everything
>using the IP address.
>
>This works!
><VirtualHost 192.168.1.111>
>	DocumentRoot /var/www/html/clientproj1 
>	ServerName www.clientproj1.com
></VirtualHost>
>
>This DOESN'T work if combined with above. The two "overlap" according to
>Apache's configtest.
><VirtualHost 192.168.1.111>
>	DocumentRoot /var/www/html/myproj
>	ServerName www.myproj.com
></VirtualHost>
>
>I think the answer is buried somewhere in here
>(http://httpd.apache.org/docs-2.1/vhosts/examples.html) but after trying
>a few different things, e.g., 192.168.1.111:8080, I couldn't get it to
>work with another subdir like "myproj." Suggestions?
>
>Jeff
>
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk




More information about the talk mailing list