Wednesday, January 13, 2010

Linux CLI - Webserver Apache - Virtual host

Okay, I'd make one extra suggestion:

Use a named host in a seperate config file. Thay way you don't get burned next time apache is upgraded.

First off make sure that the last line in /etc/httpd/httpd.conf is:

Include /private/etc/httpd/users/*.conf

It should be there by default. Then create a file in /private/etc/httpd/users called "customconfig.conf" (really whatever you want to call it). Add the following to that file:

>NameVirtualHostServer< Name myservername <- choose a severname you want here DocumentRoot "/Users/newmedia/websites" >NameVirtualHost<

Now, you're almost done. If you only want these sites accessible from your computer, add the following to /etc/hosts:

127.0.0.1 myservername

If other people need to access it, you need myservername added to the DNS for the area.

Now, from a webbrowser if you go to http://myservname apache will automatically use /Users/newmedia/websites. You can also put any server customizations in there, and test them out without affecting your main server, and if the main httpd.conf gets blown away your customization is unaffected.


Source :
http://forums.macrumors.com

No comments:

Post a Comment