Skip to content
Standalone Apache2 setup for $HOME use, essentially based on Debian 6 /etc/apache2/ configuration layout (plus some Gentoo things).
Shell PHP Perl JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin
conf
conf22
conf24
error
git_repositories
icons
local
php
ssl
svn_repositories
var
www
.gitignore
.gitmodules
README.md
apachectl
awstats
functions.sh
g
gitweb.conf
ht_basic_pwds
ht_digest_pwds
ht_groups
logs
monitor_access_log
papache
refresh_www
restart_www
sendmail_wrapper.sh
standingbear.epilogue.sh
standingbear.prologue.sh
standingbear.sh
start_www
stop_www
tail_log_files.sh
tail_php_errors_log.sh

README.md

StandingBear : Apache2 standalone setup

Essentially based on Debian 6.0.6 Apache2 configuration layout (from /etc/apache2/), slightly modified with a Gentoo spirit in places.

Apache is run in a wiped out environment.

Installation

git clone https://github.com/fabic/StandingBear.git apachesb

Configuration :

Configuration consists in :

Default environment without configuration would usually end up like :

With Apache httpd 2.2.x installed in /opt/httpd-2.2.x/.

StandingBear=/home/fabi/dev/sb
_SB=/_sb
APACHE_AdminIp=127.0.0.1

APACHE_ServerRoot=/home/fabi/dev/sb
APACHE_ConfigFile=conf/httpd.conf

APACHE_Home=/opt/httpd-2.2.26
APACHE_Httpd=/opt/httpd-2.2.26/bin/httpd
APACHE_Modules=/opt/httpd-2.2.26/modules

APACHE_Hostname=localhost
APACHE_ListenPort=8000
APACHE_ListenPortSSL=8443

APACHE_RUN_GROUP=fabi
APACHE_RUN_USER=fabi
APACHE_WwwRoot=/home/fabi/dev/sb/www

APACHE_ErrorDocuments=/opt/httpd-2.2.26/error
APACHE_Icons=/opt/httpd-2.2.26/icons
APACHE_Manual=/opt/httpd-2.2.26/manual

APACHE_HostDomain=nil

APACHE_LdapAuthURL=ldap://127.0.0.1:389/?uid?sub?(objectClass=*)

APACHE_ModPhp5SO=/opt/httpd-2.2.26/modules/libphp5.so

LANG=en_US.UTF-8
PATH=/home/fabi/dev/sb/bin:/opt/bin:./node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/usr/games/bin:/home/fabi/.bash_it/plugins/available/todo
LD_LIBRARY_PATH=nil

APACHE_Git_HttpBackend=/usr/libexec/git-core/git-http-backend
APACHE_Gitweb=nil
GIT_PROJECT_ROOT=/home/fabi/dev/sb/git_repositories
GIT_HTTP_EXPORT_ALL=nil
GITWEB_CONFIG=/home/fabi/dev/sb/gitweb.conf

SVN_PROJECTS_ROOT=/home/fabi/dev/sb/svn_repositories

APACHE_ModPassengerSo=nil
APACHE_ModPassenger_Root=nil
APACHE_ModPassenger_Ruby=/usr/bin/ruby

And this ends up as a $Env variable :

env -i  StandingBear=/home/fabi/dev/sb _SB=/_sb APACHE_AdminIp=127.0.0.1 APACHE_ConfigFile=conf/httpd.conf APACHE_ErrorDocuments=/opt/httpd-2.2.26/error APACHE_Git_HttpBackend=/usr/libexec/git-core/git-http-backend APACHE_Gitweb=nil APACHE_Home=/opt/httpd-2.2.26 APACHE_HostDomain=nil APACHE_Hostname=localhost APACHE_Httpd=/opt/httpd-2.2.26/bin/httpd APACHE_Icons=/opt/httpd-2.2.26/icons APACHE_LdapAuthURL=ldap://127.0.0.1:389/?uid?sub?(objectClass=*) APACHE_ListenPort=8000 APACHE_ListenPortSSL=8443 APACHE_Manual=/opt/httpd-2.2.26/manual APACHE_ModPassengerSo=nil APACHE_ModPassenger_Root=nil APACHE_ModPassenger_Ruby=/usr/bin/ruby APACHE_ModPhp5SO=/opt/httpd-2.2.26/modules/libphp5.so APACHE_Modules=/opt/httpd-2.2.26/modules APACHE_RUN_GROUP=fabi APACHE_RUN_USER=fabi APACHE_ServerRoot=/home/fabi/dev/sb APACHE_WwwRoot=/home/fabi/dev/sb/www LANG=en_US.UTF-8 PATH=/home/fabi/dev/sb/bin:/opt/bin:./node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.3:/usr/games/bin:/home/fabi/.bash_it/plugins/available/todo LD_LIBRARY_PATH=nil GIT_PROJECT_ROOT=/home/fabi/dev/sb/git_repositories GIT_HTTP_EXPORT_ALL=nil GITWEB_CONFIG=/home/fabi/dev/sb/gitweb.conf SVN_PROJECTS_ROOT=/home/fabi/dev/sb/svn_repositories

Which is used for invoking httpd in apachectl:

$Env \
    $APACHE_Httpd \
    -d "$APACHE_ServerRoot" \
    -f "$APACHE_ConfigFile" \
    ${ApacheDefines[@]/#/-D } \
    "$@"

Here's a sample final command that get used to start httpd :

env -i StandingBear=/home/fabi/dev/sb _SB=/_sb APACHE_AdminIp=127.0.0.1 APACHE_ConfigFile=conf/httpd.conf APACHE_ErrorDocuments=/opt/httpd-2.2.26/error APACHE_Git_HttpBackend=/usr/libexec/git-core/git-http-backend APACHE_Gitweb=nil APACHE_Home=/opt/httpd-2.2.26 APACHE_HostDomain=nil APACHE_Hostname=localhost APACHE_Httpd=/opt/httpd-2.2.26/bin/httpd APACHE_Icons=/opt/httpd-2.2.26/icons APACHE_LdapAuthURL=ldap://127.0.0.1:389/?uid?sub?(objectClass=*) APACHE_ListenPort=8000 APACHE_ListenPortSSL=8443 APACHE_Manual=/opt/httpd-2.2.26/manual APACHE_ModPassengerSo=nil APACHE_ModPassenger_Root=nil APACHE_ModPassenger_Ruby=/usr/bin/ruby APACHE_ModPhp5SO=/opt/httpd-2.2.26/modules/libphp5.so APACHE_Modules=/opt/httpd-2.2.26/modules APACHE_RUN_GROUP=fabi APACHE_RUN_USER=fabi APACHE_ServerRoot=/home/fabi/dev/sb APACHE_WwwRoot=/home/fabi/dev/sb/www LANG=en_US.UTF-8 PATH=/home/fabi/dev/sb/bin:/opt/bin:/usr/local/bin:/usr/bin:/bin GIT_PROJECT_ROOT=/home/fabi/dev/sb/git_repositories GITWEB_CONFIG=/home/fabi/dev/sb/gitweb.conf SVN_PROJECTS_ROOT=/home/fabi/dev/sb/svn_repositories \
    /opt/httpd-2.2.26/bin/httpd \
        -d /home/fabi/dev/sb \
        -f conf/httpd.conf \
        -D LANGUAGE -D REWRITE -D AUTOINDEX -D AUTH_BASIC -D DEFAULT_VHOST -D STANDINGBEAR -D INFO -D STATUS -D MANUAL -D ERRORDOCS -D DAV \
        -k start

Usage

# Output the environment Apache would be run with :
sh ./standingbear.sh

# Apache configuration test :
./apachectl -t

# Basic virtual hosts info.
./apachectl -S

# List static & shared modules.
./apachectl -M

# Customization may be done in standingbear.prologue.sh and consists in
# specifying values of environment variables that get used in Apache conf/
# files.

# Or from a prompt, e.g. :
APACHE_ListenPort=8000 \
APACHE_Modules=/usr/lib/apache2/modules \
APACHE_ModPhp5SO=/usr/lib/apache2/modules/libphp5.so.5.4 \
    ./apachectl -t

# Apache start, stop, restart
./apachectl -k start    (or ./start_www)
./apachectl -k stop     (or ./stop_www)

# Note that restart sometimes seems not enough for Apache to properly
# catch configuration changes; It happens that a real stop-start is required.
./apachectl -k restart

# Stop, sleep 1 sec., Start :
./restart_www

Directory layout

bin/
    php               : A wrapper around the PHP CLI binary.

conf/
     conf.d/
        standingbear  : /_sb/ "admin. area" is defined from herein.
     mods-available/  : Actual Apache module load & conf. statements.
     mods-enabled/    : Symlinks from ../mods-available/
     sites-available/ : default, default-ssl, www.example.org
     sites-enabled/   : Symlinks from ../sites-available/

     httpd.conf
     httpd.local.conf

conf22/    : The Apache httpd-2.2.x conf/ dir.
conf24/    : The Apache httpd-2.4.x conf/ dir.

php/
    php-chunked-xhtml/  : 
    session_files/      : PHP INI session.save_path
    upload_tmp_dir/     : PHP INI upload_tmp_dir

logs -> var/log/ symlink.

var/
    lock/
        DAVLock/
    log/
        access_log
        error_log
        rewrite.log
        php.log         : PHP INI error_log
    run/
        httpd.pid
        httpd22.pid     : See conf22/httpd.conf
        httpd24.pid     : See conf24/httpd.conf
    tmp/                : (unused)

# Where vhost's document root points at :
www/
    # Not an actual vhost, see conf/conf.d/standingbear for the Alias directives.
    _sb/
            cgi-bin/
            htdocs/

    default/
            cgi-bin/
            dav/
            htdocs/

    www.example.org/
            cgi-bin/
            htdocs/

Included stuff as Git submodules :

deprecated todo: remove these stuff.

Apigen.php, Apaxy, h5ai

git submodule status
git submodule update --init --recursive ...

ChangeLog

  • 2013-12-20 (St-Denis) : Some review; imported as-is (mostly) the httpd-2.2 & httpd-2.4 sample configuration layouts.
  • 2013-10-02 (Brussels) : Configuration review after a while...

TODO :

  • [w] README.md : Config. layout, runtime dirs, documentation.
  • Move all scripts under bin/ ??
  • Fix Allow from env=let_me_in
  • Maintenance mode thing ?
  • logrotate
  • [~] SSL conf. ? -> needs review and testing.
  • /robots.txt? (incl. search engine stuff..)
  • The missing favicon.ico
  • Remove symlinks from Git scm.
  • local/ : Is it a good idea ? --> rename to vendor/ ?
  • » Sh script for symlinking stuff in local/apache_symlinks/ & local/php_symlinks/ ?
  • ccze, AwStats...
  • Gitweb
  • "online source browser" : find an "on-the-fly" syntax highlighter for prog./markup languages.
  • Have a /_sb/ for anything StandingBear specifics, basically the whole default site thing maybe..

PHP

Misc.

  • Tomcat AJP
  • Ruby 1.8 / 1.9, mod_ruby, fastcgi-ed
  • Python, incl. fastcgi, wsgi? ...
  • Perl
  • Node.js ?!
  • Find/write ([ ] extend h5ai) a GitHub-like thing for displaying .md, .rst and such...
  • Sphinx http://sphinx-doc.org/
  • Redmine ?
  • Twitter's Bootstrap-ed ?
  • Blueprint-CSS ?
  • WebDAV enabled app (php?) for simple drag'n'drop.
  • proxy.pac file ?

Apache modules

Something went wrong with that request. Please try again.