NAME-BASED VIRTUAL HOSTS
See my Tomcat howto.
Default virtual host.
Make all settings first (in main http.conf and including other files
like default-server.conf.
Then
NameVirtualHost *:80
N.b. the default ServerName is the canonical host name, and this
also applies for the default virtual server.
It doesn't make sense to set ServerAliases for the default server,
since all all declared name will go to the default server; but it
DOES make sense to set a ServerName for the sole purpose of
preventing the default server name (the host name) from being
handled by one of the other virtual servers.
For 443 you do not want to set up a dummy site for default. In
that case, just let your first vhost be the default.
One problem with setting up a default SSL site is that it would
need a valid cert.
SuSE rewrites /etc/apache2/sysconfig.d/global.conf (just like for
loadmodule.con), so modify settings in /etc/sysconfig/apache2 in
order to cause changes there.
/etc/sysconfig/apache2 says to attempt to load all modules. Doesn't
harm anything as long as the modules are not installed. But, if they
may be installed now or in the future, remove the modules from the list.
To turn on SSL
Set APACHE_SERVER_FLAGS to "SSL" in /etc/sysconfig/apache2.
The module (.so file) is installed with the base apache2 module. Just
turn it on by adding "ssl" to the module list in /etc/sysconfig/apache2.
favicon
Error logs will bitch about about requests for non-existent favicon.ico
files unless you put a favicon.ico into place.
This is the tiny icon that browsers display in the URL window.
Just plop the file into the location bitched about.
Format: 16x16 ICO file.
First run :
java -jar /usr/local/lib/imageutil.jar /tmp/images/crayonorange.jpg 16 16
to make a 16x16 Jpeg, then use ImageMagick to conver to ICO format:
convert /tmp/images/crayonorange-16x16.jpg /tmp/co.ico
PLUGINS
If you typo the worker name in a Jk command, you will no useful
diagnostics from Apache or Tomcat.
I think that JkAutoAlias just adds the Aliases. You still need to add
all of the blocks, so what's the point?
Besides that, it doesn't work for the ROOT webapp, and can't hide apps
(like the admin webapps).
It may or may not make sense to add one block
for each virtual site, to ensure that that HTTPD does not serve /WEB-INF
in any situation.
2 things to take care of.
LET HTTPD SERVE STATIC FILES FOR ALL WEBAPPS
Just make a block and an alias command for every webapp.
LET TOMCAT SERVE DYNAMIC FILES FOR ALL WEBAPPS
Add JkUnMount commands to exclude everything that you want served
statically by Httpd (don't exclude WEB-INF/* so that Tomcat will
block that for you). I like *.gif, *.zip, *.jar, *.jpg, *.jpeg, *.png.
FOR EACH WEBAPP
Exclude HTTP serving like "JkUnMount /lm/images/* balderWorker".
Add two JkMount commands for each. One for the non-slash root,
and one for everyting else: "JkMount /lm ..." and "JkMount /lm/* ...".
APACHE OPTIONS
Can prefix each and every option with + or -, in which case the given
settings override all inherited options. Otherwise, settings are absolute.
ExecCGI
Indexes Directory indexes
Includes ssi's
IncludesNOEXEC. #execs prohibited, but #includes still permitted.
FollowSymLinks*
FollowSymLinksIfOwnerMatch* (if sym link and target dir/file match)
All (does NOT include MultiViews) or None
MultiViews. Auto mime-type and extension negotiation (reqs. addl. config)
* these options do not apply to blocks.
Other sub-directives:
AllowOverrides* What .htaccess files may do
* this option does not apply to blocks.
Wildcard/Regexes are described under the heading
"Wildcards and Regular Expressions" at
WHERE???
It seems that ~ or *Match directives are only needed for fancy Regexes.
Regular and can take * and ? patterns, and also
automatically match the beginning of a string.
I.e., you MUST use ~ or *Match to NOT have an implicit *$ at end of your
pattern.
Only need to quote pattern if it has funky characters (like blanks).
http://server.africapolicy.org/manual/sections.html .
See the section "How the sections are merged" about precedence of
multiple s, s, s, and mixes thereof.
The
I *think* that, unlike , the pattern must include
the entire URL string. Normal wildcards like * and ? work anywhere, but
extended regular expressions require LocationMatch or ~.
useCanonicalName says to use the ServerName for aliasing, redirecting,
or something similar. Works to change user's URL to the desired URL,
but the better way to do that is to capture the bad URL explicitly.
This prevents sites from being accessed independently with more than one
URL.
Syntax-check:
apachectl -t
OR
apachectl configtest