Send a link

Apache

Table of contents



Installation

Since a good while back I have been using FreeBSD ports for installing Apache 2.2 - because it just works!

I usually also install these ports:
databases/p5-DBD-mysql50
 mail/p5-Mail-CheckUser
 www/p5-libapreq2 && make (WAS: www/libapreq2 && make WITH_MODPERL2=1)
 www/p5-CGI.pm
 www/p5-MasonX-Request-WithApacheSession

And a few not found in ports, installed via "perl -MCPAN -e shell":
Time::Format

But if you desire a manual configuration...

Configure options for Apache 2.2.x:
./configure \
--prefix=/usr/local/www22 \
--enable-ssl \
--with-ssl=/usr/local \
--enable-expires \
--enable-headers \
--enable-usertrack \
--enable-unique-id \
--enable-vhost-alias \
--enable-rewrite \
--enable-so


If you don't have httpaccept loaded in your kernel - please take a look at these options:
<IfDefine NOHTTPACCEPT>
   AcceptFilter http none
   AcceptFilter https none
</IfDefine>


Also see FreeBSD for optional kernel options (recommended).

SSL certificate

How to generate a self signed SSL certificate without pass phrase:
openssl genrsa -out server.key
openssl req -new -nodes -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt


Hosting multiple Django sites in one virtual host

First, setup your virtual host
<VirtualHost *:80>
...
DocumentRoot /home/sites/example/htdocs

<Location "/site1">
        SetHandler python-program
        PythonInterpreter site1
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE site1.settings
        PythonOption django.root /site1
        PythonDebug On
        PythonPath "['/home/sites/example'] + sys.path"
</Location>
Alias /site1/media/ /home/sites/example/htdocs/site1/media/

<Location "/site2">
        SetHandler python-program
        PythonInterpreter site2
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE site2.settings
        PythonOption django.root /site2
        PythonDebug On
        PythonPath "['/home/sites/example'] + sys.path"
</Location>
Alias /site2/media/ /home/sites/example/htdocs/site2/media/

</VirtualHost>


Then, inside each settings.py remember to set
TIME_ZONE = 'Europe/Copenhagen'
SITE_ID = 'X'
SESSION_COOKIE_NAME = 'Y'

Where X is 1 and 2 respectively, and Y is site1 and site2.

If your media path is not working correctly, maybe try this alternative location
MEDIA_ROOT = '/home/sites/example/htdocs/media/siteX/'
MEDIA_URL = '/media/siteX'
ADMIN_MEDIA_PREFIX = '/media/siteX'


Hints

IndexOptions FancyIndexing VersionSort NameWidth=*


AddDefaultCharset On


  • + : A leading plus sign indicates that this word must be present in every object returned.
  • - : A leading minus sign indicates that this word must not be present in any row returned.
  • By default (when neither plus nor minus is specified) the word is optional, but the object that contain it will be rated higher.
  • < > : These two operators are used to change a word's contribution to the relevance value that is assigned to a row.
  • ( ) : Parentheses are used to group words into subexpressions.
  • ~ : A leading tilde acts as a negation operator, causing the word's contribution to the object relevance to be negative. It's useful for marking noise words. An object that contains such a word will be rated lower than others, but will not be excluded altogether, as it would be with the - operator.
  • * : An asterisk is the truncation operator. Unlike the other operators, it should be appended to the word, not prepended.
  • " : The phrase, that is enclosed in double quotes ", matches only objects that contain this phrase literally, as it was typed.

Menu