Casino En LigneMigliori Casino Non AamsCasino Online Non AamsBetting Sites UKCasino UK Sites
More Related Stories

Apple Mac OS X v10.4 "Tiger" Mac OS X Tiger offers a rock-solid, developer-frie...
From: $97 to $128
Apple Mac OS X v10.4 "Tiger" - MA453Z/A Mac OS X v10.4 "Tiger"
From: $89 to $1,140
Apple Mac OS Version 10.0 Full Version For Mac Apple MAC OS X (M7686LL/A)
From: $63
Tutorial: Page (1) of 2 - 05/31/06 Email this story to a friend. email article Print this page (Article printing at MyDmn.com).print page
Mac OS X Web Server Tips for Designers, Part 2 Symlinks + default documents + hosts file = big fun By Kevin Schmitt We've been rolling through one of the decidedly unsexy (albeit often necessary) aspects of being a Web designer: the need to actually use an honest-to-goodness Web server to test out your sites. Mac OS X makes this process pretty easy, but there are some extra steps one can take to make the whole experience a tad more full-featured. Let's go over a few more tips for adding some extra bling to Mac OS X's indigenous Web server.

Tip #4: Embrace the symlink

When we last left off, I had just finished describing one method of changing your Document Root directory to the location of your choice by using Bare Bones' Text Wrangler (or BBEdit, if you prefer, as I do) to edit the Apache httpd.conf file. If you'd like to review this process, by all means click on this link to read Part 1 . You're going to need some of the knowledge (such as it is) contained there if you want to follow along a little later. In the meantime, there's a much simpler way to change your Document Root that nicely frames our brief discussion about symbolic links.

If you remember from last time, the Apache Web server built into OS X uses the /Library/WebServer/Documents directory as the default folder to serve Web pages from. This time, we're going to use a symbolic link to change the directory rather than edit the configuration file. If you happen to be unfamiliar with symbolic links (or symlinks for short), here's the lowdown: symlinks have their roots in Mac OS X's Unix underpinnings, and are sort of like the tried-and-true "classic" Mac aliases. However, instead of being a simple pointer to folders or files on your system, a symlink is seen by the system as an actual instance of said file or folder. Such a distinction is important when it comes to Mac OS X's Web server, as Apache will respect and "follow" symlinks, while it will ignore aliases. Therefore, it's possible to create a symlink of the desired folder that you want to use as your root folder, and then move that symlink to where Apache expects to find it. The question becomes, then, how to best create symlinks, since Apple still only makes it easy by default to create aliases. You could, of course, use the Terminal to create symlinks, but as I promised last time that I wouldn't go down that road, we need a more GUI-fied solution. Enter Nick Zitzmann's Symbolic Linker, a free contextual menu item which can be downloaded from this link. Once you install Symbolic Linker and log out and log back in (or at least force restart the Finder), all you need to do to right/control-click on the file or folder you want to make a symlink to and select "Make Symbolic Link" from the contextual menu (fig. 1). You can then move and rename and do whatever else with the symlink you like, as it's just another item in the Finder to be manipulated like anything else.



Figure 1

Now that we're all up to speed with symlinks and how to easily create them, let's run through the process of using a symlink to point at a different root folder. Note that this procedure assumes that you haven't already changed the location through the httpd.conf file the way we did last time.

  • In the /Library/WebServer/ folder, rename the Documents directory to DocumentsBak (or some other name—the point is not to delete the directory outright in case you ever want to change things back).
  • Navigate to your desired root folder (remember, in our earlier example, the path was /Volumes/Data/DocRoot), right-click on it, and select "Make Symbolic Link."
  • Drag and drop the symlink (which, in our example, will now be called DocRoot symlink) to the /Library/WebServer folder.
  • Rename the symlink to Documents.
  • Restart the server by going to the Sharing Preference Pane and clicking the Stop and then the Start buttons next to Personal Web Sharing service.

That's it. The server will then follow the symlink to your new document root folder. However, as Ron Popeil might say, "But wait—there's more!" Now that you have the whole symlink thing down, you'll probably also want to use symlinks to point to various other folders on your hard drive. For example, say you have a big client, which we'll call "BiggCo." You're doing some Web work for BiggCo, so naturally, you have a BiggCo directory somewhere on your hard drive. Inside that directory is likely another directory where you store your Web files, perhaps named Web Docs. You could do the following:

  • Create a symlink for your BiggCo/Web Docs folder.
  • Drag the symlink to your DocRoot folder.
  • Rename the symlink to biggco.

Now, using one of the various URLs alluded to in the last installment, you could then point your browser at http://localhost/biggco/ and see your BiggCo Web files in all their glory. So, just to sum things up, symlinks can not only be used to "move" your Document Root directory without editing the configuration file, they can also redirect individual directories so you can keep project files in a single place.

Tip #5: Change the default document

If you've done any sort of Web design, you're no doubt highly aware that each server you post files to has a default document that it will serve up. Whether it's default.htm, index.html, or something else, any file named for the server's default will be automatically displayed when the root URL or subfolder is accessed (e.g., http://www.site.com/ or http://www.site.com/directory/). Of course, if you're not happy with index.html, which is the Mac OS X server default, you can easily change this as well. Now, for this hint, you'll need to be up to speed with the whole TextWrangler/BBEdit setup that was outlined last time for editing the httpd.conf file, so you may want to review that process if you skipped the previous installment.

As per the instructions from last time, open up the httpd.conf file, hit Command+F in either TextWrangler or BBEdit, and look for the text "index.html" (without quotes, of course). In BBEdit, this should appear at or around line 445. The full text in question should look like this:

# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
    DirectoryIndex index.html
</IfModule>

 

Page: 1 2 Next Page

Related Sites: Creative Mac ,   Digital Producer ,   Audio Video Producer ,   Corporate Media News ,   Digital Media Designer ,   Oceania ,   MacDesignPro
Related Newsletter: DMN Newsletter ,   Pixels Newsletter ,   Mac Alert Newsletter ,   Digital Media Net ,   DMNForums ,   Tutorial Finder
To Comment on This Article, Click HERE

Most Recent Reader Comments:
  • Re: Mac OS X Web Server Tips for Designers, Part 2 by DCrellen at Jun. 08, 2006 8:25 pm gmt
  • Mac OS X Web Server Tips for Designers, Part 2 by DMN Editorial at May 31, 2006 10:30 pm gmt

    Click Here To Read All Posts
    Must be Registered to Respond (Free Registration!!!, CLICK HERE)
  • macromedia software
    Macromedia Studio 8 for Windows or Mac (Rated by 4 users)
    Meant to be enjoyed by professional Web editors and multimedia enthusiasts alike, Studio 8 from Macromedia is a versatile, integrated suite for designing, developing and ...
    Price Range $490 to $999View Details Related Items

    SoftwareKing: $489.99
    RoyalDiscount: $699.96
    VioSoftware: $869.00
    Macromedia Director MX 2004 for Win or Mac Retail Box (Rated by 0 users)
    This is brand new factory sealed retail box. Not academic or upgrade.
    Price Range $834 to $1,149View Details Related Items

    DirectDeals: $835.00
    RoyalDiscount: $834.96
    VioSoftware: $833.99
    Macromedia Director MX 2004 (Rated by 0 users)
    DIRECTOR MX 2004 FULL ENG CD
    Price Range $834 to $1,149View Details Related Items

    VioSoftware: $833.99
    DirectDeals: $835.00
    RoyalDiscount: $834.96
    Macromedia Flash Professional - - complete package (Rated by 5 users)
    Flash Professional is the industry's most advanced authoring environment for creating interactive websites, digital experiences and mobile content.
    Price Range $339 to $630View Details Related Items

    VioSoftware: $346.43
    Superdealonline: $450.00
    RoyalDiscount: $420.00
    Macromedia Dreamweaver 8 Academic (Rated by 0 users)
    Dreamweaver 8.0 is the industry-leading web development tool, enabling you to efficiently design, develop and maintain standards-based websites and applications.
    Price Range $176 to $212View Details Related Items

    DirectDeals: $185.95
    VioSoftware: $199.99
    CampusTech: $189.65
    Adobe Creative Suite 2 Premium with Macromedia Flash Professional 8 Win (Rated by 0 users)

    Price Range $970 to $1,626View Details Related Items

    TECH USA: $970.00
    DirectDeals: $1626.20
    VioSoftware: $1599.95
    HOT THREADS on DMN Forums
    Page Title can't change using Dreamweaver Template Pages?!? (1) • by blueStupa on the on the Web Design forum Mac vs PC color difference??? (1) • by Mark Griesbauer on the on the Adobe Photoshop forum WEBLO Celebrities One for Everyone  • by Weblo on the on the Writers, Actors & Artists forum Poser 7 announced  • by Brian on the on the Poser forum **Professionally Trained Composer**  • by Mike Watts on the on the Demo Reels forum [FORUM NEWS] ONE DAY SALES (OCTOBER 23-27) LIMITED  • by Ko on the on the Plugin Central forum Adobe Photoshop Style Layer Tutorial  • by videxpertise on the on the Adobe Photoshop forum
    Marketplace
    Laptop LCD Screen
    Replacement laptop screens for your high resolution graphics needs! We carry high resolution LCD screens for all brands including, Apple, Compaq, Dell, IBM, HP, Sony, Gateway,...
    Free CorelDraw Graphics Suite X3
    Get the CorelDraw Graphics Suite X3 for free when you complete sponsor's survey!
    Free DigiMemo Digital Notepad
    Digitally capture and store handwritten notes for free! survey required
    Get your Designs noticed
    Stand out from the crowd. Place your design onto a professional looking CD or DVD. Primera offers CD-DVD Printers and disc duplicators to help you get your design out there.
    Laptop Screen
    We stock laptop LCD screens for all brands of notebooks including Dell, IBM, Compaq, Sony, Toshiba, Gateway, HP and more. We have thousands of laptop screens to fulfill your L...
    Free Creative Xmod X-Fi Module
    Enjoy surround sound on any stereo/speaker system/headphones using this free module! survey required
    Buy a Link Now!
    © Copyright, 2006 Digital Media Online, All Rights Reserved