Running Linux, 5th Edition - Matthias Kalle Dalheimer [431]
None
Disable all options for this directory.
All
Enable all options for this directory.
There are other options as well; see the httpd documentation for details.
Next, we configure a very strict default configuration for the complete filesystem.
# Default configuration
# Turn all features off
Options None
# Do not allow local files to override configuration.
AllowOverride None
# In fact, do not allow access
to any of the files.
Order allow,deny
Deny from all
We have started by denying access to the complete filesystem. Now we proceed to explicitly allow access to the files we want Apache to serve. At the very least we need to enable several options and other attributes for /usr/local/httpd/htdocs, the directory containing our HTML documents. This configuration applies to the base directory and the subdirectories below it.
# Configuration for the web server files.
# Allow automatic indexes and controlled symbolic links. Options Indexes SymLinksIfOwnerMatch # Allow the local access file, .htaccess, to override # any attributes listed here. AllowOverride All # Allow unrestricted access to files in this directory. Order allow,deny Allow from all
Here, we turn on the Indexes and SymLinksIfOwnerMatch options for this directory. The AllowOverride option allows the local access file (named .htaccess) in each directory that contains documents to override any of the attributes given here. The .htaccess file has essentially the same format as the global configuration but applies only to the directory in which it is located. This way, we can specify attributes for particular directories by including a .htaccess file in those directories instead of listing the attributes in the global file.
The primary use for local access files is to allow individual users to set the access permissions for personal HTML directories (such as ~/public_html) without having to ask the system administrator to modify the global access file. Security issues are associated with this, however. For example, a user might enable access permissions in her own directory such that any browser can run expensive server-side CGI scripts. If you disable the AllowOverride feature, users cannot get around the access attributes specified in the global configuration. This can be done by using:
AllowOverride None
which effectively disables local .htaccess files.
The Deny from ..nuts.com biffnet.biffs-house.us The first entry denies access from all sites in the nuts.com domain. The second denies access from the site biffnet.biffs-house.us. srm.conf and access.conf The srm.conf and access.conf files should be kept empty. In earlier Apache versions, srm.conf stood for Server Resource Map and listed facilities provided by the server, and access.conf controlled access to Apache files. All the resources originally placed in those files are now listed in the main httpd .conf file. Starting httpd Now you're ready to run httpd, allowing your machine to service HTTP URLs. As mentioned previously, you can run httpd from inetd or as a standalone server. Here, we describe how to run httpd in standalone mode. All that's required to start httpd is to run the command: httpd -f configuration-file where configuration-file is the pathname of httpd.conf. For example: /usr/sbin/httpd -f /etc/httpd/httpd.conf starts up httpd, with configuration files found in /etc/httpd. Watch the httpd error logs (the location of which is given in httpd.conf) for any errors that might occur