Webservers

Rainer Volz edited this page Apr 21, 2015 · 9 revisions

BicBucStriim comes with a .htaccess file, a configuration for the Apache web server. This configuration is included because most NAS devices include a LAMP environment, and so the app can easily be installed. However, there are other web servers, and BicBucStriim doesn't require you to use Apache.

This section contains usage examples with different web servers or environments.

Apache on Raspberry Pi

This example assumes that you are using the standard Raspbian Wheezy distribution. Raspian is derived from Debian, so this example applies also to Debian, Ubuntu etc.

  1. Install Apache: sudo apt-get install apache2. (Note: This will also install the required sqlite3 library.)
  2. Install PHP: sudo apt-get install php5 php5-sqlite php5-gd. Install PHP 5.2+, the Sqlite3 support to read the Calibre metadata and the GD library to generate thumbnails.
  3. Enable URL Rewriting for Apache: sudo a2enmod rewrite
  4. Enable the usage of htaccess files (BucBucStriim incudes one):
    1. sudo nano /etc/apache2/sites-available/default
    2. In section <Directory /var/www> change 'AllowOverride NonetoAllowOverride All`.

The web server root directory is /var/www, so BicBucStriim should be installed there, using the usual process.

Lighttpd on Raspberry Pi

This example assumes that you are using the standard Raspbian Wheezy distribution. Raspian is derived from Debian, so this example applies also to Debian, Ubuntu etc.

  1. Install Lighttpd and Sqlite3: sudo apt-get install lighttpd sqlite3
  2. Install PHP: sudo apt-get install php5-common php5-cgi php5 php5-sqlite php5-gd. Install PHP 5.2+, the Sqlite3 support to read the Calibre metadata and the GD library to generate thumbnails.
  3. Enable the server to handle PHP scripts: sudo lighty-enable-mod fastcgi-php
  4. Add URL Rewriting for BicBucStriim:
    1. sudo nano /etc/lighttpd/lighttpd.conf
    2. Add the following lines at the end: url.rewrite-once = ("^/bbs/(?!(style|img|js|installcheck.php)).*$" => "/bbs/index.php/$1")
    3. Check that server.modules includes mod_redirect, if not add it.
  5. Reload the server: sudo service lighttpd force-reload

The web server root directory is /var/www, so BicBucStriim should be installed there, using the usual process.

Check Running a lightweight webserver on the Raspberry Pi (lighttpd) for more information about Lighttpd on the Raspberry Pi.

Ngnix on Raspberry Pi

This example assumes that you are using the standard Raspbian Wheezy distribution. Raspian is derived from Debian, so this example applies also to Debian, Ubuntu etc.

  1. Install Nginx and Sqlite3: sudo apt-get install nginx sqlite3
  2. Install PHP: sudo apt-get install php5-common php5-cgi php5 php5-sqlite php5-gd. Install PHP 5.2+, the Sqlite3 support to read the Calibre metadata and the GD library to generate thumbnails.
  3. Add URL Rewriting for BicBucStriim:
    1. sudo nano /etc/nginx/sites-available/default
    2. Change the root directory: root /var/www
    3. Add URL Rewriting for BucBucStriim, see below
  4. Reload the server: sudo service nginx reload

A simple configuration for URL rewriting is:

location /bbs/ {
                rewrite ^/(bbs/img/.*)$ /$1 break;
                rewrite ^/(bbs/js/.*)$ /$1 break;
                rewrite ^/(bbs/style/.*)$ /$1 break;
                rewrite ^/bbs/$ /bbs/index.php last;
                rewrite ^/bbs/(admin|authors|authorslist|login|logout|metadata|search|series|serieslist|tags|tagslist|titles|titleslist|opds)/.*$ /bbs/index.php last;
 }

The web server root directory is /var/www, so BicBucStriim should be installed there, using the usual process.

Check this discussion for more information on installing Ngnix on the Raspberry Pi.

IIS

IIS configuration provided by @nachtfever, see here:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    <security>
      <requestFiltering allowDoubleEscaping="True" />
    </security>
        <rewrite>
            <rules>
                <rule name="slim" patternSyntax="Wildcard">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>