Related Article(s): |
Contributed by Eric Taylor (heavyboots)
Print
Email
Additional Useful Apache2 Config Settings
These edits all take place in your apache2 config file, most likely located
in /apache2/conf/httpd.conf.
Default User
The default user for OS X should be www instead of nobody. Search for:
User nobody
Group nobody
and change to:
User www
Group www
.htaccess Security Settings per Apple
Apple now has a rather longer .htaccess denial section (as of the 12-02-04
Security Update). You can duplicate it by searching for the line
# The following lines prevent .htaccess files from being viewed by
and replacing the uncommented Files directive below it with the following three
directives
<Files ~ "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
Order allow,deny
Deny from all
Satisfy All
</Files>
<Files "rsrc">
Order allow,deny
Deny from all
Satisfy All
</Files>
<DirectoryMatch ".*\.\.namedfork">
Order allow,deny
Deny from all
Satisfy All
</DirectoryMatch>
The cgi-bin Directory
Additionally, if you're planning to keep using the /Library/WebServer folder,
don't forget to change your cgi-bin folder settings. Search for the ScriptAlias
line and make it look like this
ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
Using the System Prefs Sharing Panel to Control Apache2
Finally, if you want to be able to use your System Preferences Sharing pane to
start and stop your apache2 install, there are a couple of things to do. First
is to find the PidFile section and make it look like this
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
#
#<IfModule !mpm_netware.c>
PidFile /private/var/run/httpd.pid
#</IfModule>
Note that not only has the PidFile path been changed to be in the /private/var/run
folder, but also, the IfModule lines have been commented out.
At this point, all necessary modifications have been made to the apache2 conf
file--we just need to link up the apachectl for apache2 to replace the one that
is installed by default by Apple. So save your httpd.conf file and in Terminal
do the following.
cd /usr/sbin/;
mv apachectl apachectl-1.3;
ln -s /apache2/bin/apachectl apachectl;
Basically, this renames the old Apple apachectl to be apachectl-1.3 (and you can
even start and stop the original Apple apachectl by using that command). Then it
makes a symbolic link from our apache2 folder into the /usr/sbin folder. Now
when you start and stop Web Sharing from the System Preferences panel, you
should be starting and stopping apache2.
www.phpmac.com

Site
Management
Index