Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpd Wiki" for change notification.
The following page has been changed by thumbs: http://wiki.apache.org/httpd/DebianDeb0rkification ------------------------------------------------------------------------------ And that's it. Those are the additions/changes one has to do in ''apache2.conf'' in order to set sane defaults. === sites-enabled === - There's one marvelous attribute about Debian's configuration and that's the introduction of a default virtual host. With the addition of scripts to manage ''sites''. + There's one marvelous attribute about Debian's configuration: the introduction of a default virtual host, and scripts to automate the addition/removal of ''sites''. - And then there's this peculiar section in ''sites-enabled'' that is the default-vhost, which people take as example, copy and paste and create chaos: + The default ''sites'' file, called ''sites-enabled'', contains this: {{{ NameVirtualHost * <VirtualHost *> @@ -156, +156 @@ </VirtualHost> }}} - This configuration is overly verbose, complex, and, unnecessary. Instead of pointing out what's wrong with it, I will simply move on to show how to do it better: + This configuration is overly verbose, complex, and, unnecessary. Instead of pointing out every configuration error in it, I will rewrite it from scratch: In ''apache2.conf'' change: {{{ # Include all the user configurations: @@ -173, +173 @@ ErrorLog "|/usr/bin/rotatelogs /var/log/apache/some.domain.tld/error_log.%Y%m%d 86400" </VirtualHost> }}} - Again, note the difference with the now ''VirtualHost *:80'' directive, to match the ''NameVirtualHost *:80'' directive. + Again, note the difference with the new ''VirtualHost *:80'' directive, to match the ''NameVirtualHost *:80'' directive set in the ''apache2.conf'' file earlier. - We removed the CustomLog directive as all are catched by the one defined in the ''apache2.conf'' - thus effectively reducing the number of open file handles. + We removed the CustomLog directive as the one defined in the ''apache2.conf'' will propagate to every virtual host - effectively reducing the number of open file handles. - We got rid of all the superfluous ''<Directory>'' blocks - especially with it's awkward ''Options'' directives. Again, with the sane settings in the ''apache2.conf''. + We got rid of all the superfluous ''<Directory /var/www>'' and ''<Directory />'' blocks - especially with it's awkward ''Options'' directives. Again, with the sane settings in the ''apache2.conf'' file. The user may add +Indexes if he wishes to display a formatted list of the directory contents in the absence of a index file specified with the ''DirectoryIndex'' directive. - And defused the danger of ambiguity, by changing, and moving the ''NameVirtualHost *:80'' directive above the ''Include'' line for the virtual hosts, thus enabling new administrators to simply copy and paste and edit this file. + We defused the danger of ambiguity, by changing, and moving the ''NameVirtualHost *:80'' directive above the ''Include'' line for the virtual hosts, thus enabling new administrators to simply copy and paste and edit this file.
