MacOS – web sharing for vhosts

apachemacoswebserver

I'd like to be able to share websites I'm developing with other users in my network using Web Sharing. I don't develop in my 'Sites' folder though, I have a separate folder for all my projects.

(Note: web sharing is working generally. If I visit http://[my-local-ip-address]/~[myusername] it shows the default local Site that I never touch.)

e.g. I use apache's httpd-vhosts.conf file and /etc/hosts to setup local domains that can be accessed by me like so:

http://mytestsite

So.. can I configure OS X Lion & apache to allow other to see them around the LAN like this?

http://[my-local-ip-address]/~mytestsite

Thanks!
Ben

Best Answer

Yes, you can configure Mac OS X 10.7, aka Lion, to serve multiple web sites using URLs like http://[my-local-ip-address]/~mytestsite.

The format of URL you suggest can be achieved by creating a new user for each site, and storing the web pages in that user's Sites folder.

Alternatively, you could create subfolders within your site's folder:

  • http://[my-local-ip-address]/~[myusername]/site1
  • http://[my-local-ip-address]/~[myusername]/site2
  • http://[my-local-ip-address]/~[myusername]/site3

Going another step further, you can customise the Apache httpd 2 configuration files at /etc/apache2/users/[myusername] to tweak the set up to your exact needs.