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 megaspaz:
http://wiki.apache.org/httpd/ScratchPad/CommonMisconfigurations

------------------------------------------------------------------------------
  
  The second virtual host is wrong because when using name based virtual hosts, 
the !ServerName is used by Apache to determine which virtual host configuration 
to use. Without it, Apache will never use the second virtual host configuration 
and will use the default virtual host. The default virtual host when using name 
based virtual hosts is the first defined virtual host.[[BR]][[BR]]
  
- ==== 3. Mixing NameVirtualHost * with NameVirtualHost *:<some port>. ====
+ ==== 3. Mixing non-port and port name based virtual hosts. ====
  Example:
  {{{NameVirtualHost *
  NameVirtualHost *:80
@@ -78, +78 @@

  Because of the nature of SSL, host information isn't used when first 
establishing a SSL connection. Apache will always use the certificate of the 
default virtual host, which is the first defined virtual host in name based 
virtual hosts. While this doesn't mean that you won't ever be able to access 
the second virtual host, it does mean your users will always get a certificate 
mismatch popup warning when trying to access some.domain2.com. Read more about 
this at [http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html#vhosts2].[[BR]][[BR]]
  Also, note that the configuration above isn't something someone would 
normally use for SSL. However, using !NameVirtualHost *:443 is commonly seen in 
howtos for Debian/Ubuntu.[[BR]][[BR]]
  
+ === Scope ===
+ 
+ ==== 1. Adding/Restricting access and options in <Directory /> ====
+ Example:
+ {{{<Directory />
+   # This was changed from the default of AllowOverride None.
+   AllowOverride FileInfo, Indexes
+   # Default directives defined below.
+ </Directory>
+ }}}
+ 
+ <Directory /> is not a URL path. It is a filesystem path. Making changes in 
this <Directory> block will have no effect on your website !DocumentRoot. In 
the example above, what might have been attempted was being able to use 
htaccess in the !DocumentRoot. The problem being that the htaccess file will 
still be ignored because the !AllowOverride is set in the wrong <Directory> 
block.[[BR]][[BR]]
+ 
+ ==== 2. Trying to set directory and index options in a script aliased 
directory. ====
+ Example:
+ {{{ScriptAlias /cgi-bin/ /var/www/cgi-bin/
+ <Directory /var/www/cgi-bin>
+   AllowOverride None
+   Options Indexes, ExecCGI
+   DirectoryIndex index.cgi
+   # Other options defined.
+ </Directory>
+ }}}
+ 
+ Script aliased directories do not allow for directory listings specified with 
Options Indexes. This is a security feature. Also, script aliased directories 
automatically try and execute everything in them. So, Options ExecCGI is 
unnecessary. The !DirectoryIndex directive also does not work in a script 
aliased directory. The workaround for this if you really need directory 
listings or other directory indexing options is to use Alias instead of 
!ScriptAlias.[[BR]][[BR]]
+ Example:
+ {{{Alias /cgi-bin/ /var/www/cgi-bin/
+ <Directory /var/www/cgi-bin>
+   AllowOverride None
+   Options Indexes, ExecCGI
+   DirectoryIndex index.cgi
+   # Other options defined.
+ </Directory>
+ }}}
+ 
+ The options above will now work.[[BR]][[BR]]
+   
+ (!) TODO (!)
+ 
+ Add some more commonly seen stuff
+ 

Reply via email to