Apache Virtual Host

The following is an example Apache virtual host that will serve .obyx pages after rendering them with the obyx CGI.

As you can see the obyx binary is is stored in /var/www/cgi/obyx.cgi and the publicly accessible web files are stored in /var/www/site/example/pubroot with the scripts directory non-publicly accessible in /var/www/site/example/scripts.

Obyx configurations in apache require the following apache modules to be enabled.

  • Actions
  • Rewrite
These are not enabled on Debian by default and can be loaded by using the a2enmod command.


<VirtualHost *:80>
    <IfModule mime_module>
        RewriteEngine  on
        AddType application/obyx+xml    .obyx
        Action  application/obyx+xml  /cgi/obyx.cgi
    </IfModule>

    ServerAdmin obyx@example.com
    DocumentRoot /var/www/site/example/pubroot
    ServerName example.com
    ErrorLog /var/log/apache2/example-error_log
    CustomLog /var/log/apache2/example-access_log common

    #Site Configuration
    #SetEnv OBYX_DEVELOPMENT on
    SetEnv OBYX_SQLSERVICE_REQ true
    SetEnv OBYX_ROOT_DIR /var/www/site/example/pubroot/
    SetEnv OBYX_SCRIPTS_DIR /var/www/site/example/scripts/
    SetEnv OBYX_SCRATCH_DIR /tmp/

    #Database Configuration
    SetEnv OBYX_SQLSERVICE mysql
    SetEnv OBYX_SQLDATABASE obyx_database
    SetEnv OBYX_SQLHOST localhost
    SetEnv OBYX_SQLUSER obyx_db_user
    SetEnv OBYX_SQLUSERPW obyx_password
    SetEnv OBYX_SQLPORT 3306

    #Engine Configuration
    SetEnv OBYX_VALIDATE_ALWAYS true
    
    ### IGNORE THESE - Unless you're using a mac
    #SetEnv OBYX_LIBCURLSO libcurl.dylib
    #SetEnv OBYX_LIBPCRESO /usr/local/lib/libpcre.dylib
    #SetEnv OBYX_LIBMYSQLCRSO /usr/local/mysql/lib/libmysqlclient_r.dylib
    #SetEnv OBYX_LIBPQSO /usr/local/pgsql/lib/libpq.dylib
    #SetEnv OBYX_LIBZIPSO libz.dylib

    ScriptAlias    /cgi/   /var/www/cgi/
    <LocationMatch "^/cgi/[0-9a-zA-Z]+\.cgi" >
        Order Deny,Allow
        Deny from All
        Allow from env=REDIRECT_STATUS
    </LocationMatch>
    <Directory "/var/www/cgi">
        Options -Indexes -MultiViews FollowSymLinks
        Order Deny,Allow
        Deny from All
        Allow from env=REDIRECT_STATUS
    </Directory>
</VirtualHost>




Last Modified: Thu, 15 Jan 2015