Change default route in apache

When I first got the Mac I just started setting up my web pages the way I used to. However, when I am using Dreamweaver and press F12 for Safari to test the page, it doesn't work. I finally figured out this is because my pages are not filed under "myname>sites."

If I want this feature to work like it did on my old system 9 Mac, do I really have to file everything under the default route, or can I go into somewhere in apache and change where it looks for the folders for the web pages to test?

iMac, Mac OS X (10.4.8)

Posted on Oct 23, 2006 6:37 PM

Reply
4 replies

Oct 25, 2006 5:07 PM in response to Scottford

Apache's documentation is fairly vast, and can seem daunting if you're not used to it. There are a number of ways in which it looks for files, but the main thing to look for in /etc/httpd/httpd.conf is the "DocumentRoot" directive. It's set by default to /Library/Webserver/Documents.

Note that changing DocumentRoot won't be quite enough; you should also look for the <Directory "/Library/WebServer/Documents"> stuff</Directory> bit and change the string in that tag to your new location. This part is security settings, like the bit mentioned in your post above.

Specific file locations for specific users are loaded in by a separate module, called "mod_userdir". All it does is produce extra file locations, one for each user. By default it's given the parameter "UserDir Sites", so your personal site ends up being "/Users/<your username>/Sites". You could change that to "UserDir Documents" and it would serve up your documents folder, though I don't recommend that! This module changes the default location for all users at once, though, so be careful if you have others using the same machine - they might find their own personal web sites not working any more.

You may actually find it easier to modify Dreamweaver. I don't have it, so I can't say for sure, but I'd bet that it has a preference to set the 'root' file location for the Web server; just set it to /Library/WebServer/Documents.

There is just one more thing - file permissions. httpd.conf is owned by the root user, so you'll need administrator access on your machine enabled to change apache's configuration. The /Library/WebServer/Documents folder is owned by root, but the admin group has write access. If you (the user you normally log in as) installed your OS, you already have admin access. If you're working on a machine managed by an administrator, then you need to ask him or her to add you to the admin group (the admin group is similar to a Windows Power User - you can install software for anyone on the machine, but you can't touch system files).

And, for any complete newbies who might be surfing by and haven't been scared away yet, don't forget to start and stop the Web server (under Sharing in System Preferences) for changes to the apache configuration to take effect.

For further reference, you also have the apache manual installed by default on your machine, just browse http://localhost/manual/

Oct 24, 2006 10:40 PM in response to Niel

Thank you for this reply. This got me part way there, but I am still befuddled by where to go in UNIX code in httpd.conf to change where Dreamweaver defaults it's lookup when testing a page.

I think this may be the section, but I cannot figure out what else to substitute. I understand if this is too sensitive/complicated to explain to someone like me.

# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /Users/*/Sites>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS PROPFIND>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS PROPFIND>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>

#
# 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>

#
# AccessFileName: The name of the file to look for in each directory
# for access control information.

Also, because of your response, I found this interesting article and downloaded Text Wrangler.

http://www.macfixit.com/article.php?story=20051025072741685

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Change default route in apache

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.