Up 0 Down 0

Spotweb installation in jail

Install the following packages:

pkg install php5-extensions
pkg install php5-xmlrpc
pkg install php5-gettext
pkg install php5-mcrypt
pkg install php5-mbstring
pkg install php5-zip
pkg install php5-gd
pkg install php5-zlib
pkg install php5-curl
pkg install php5-mysql
pkg install php5-openssl
pkg install php5-pdo_mysql
pkg install php5-mysqli
pkg install php5-pgsql
pkg install php5-pdo_pgsql
pkg install php5-ftp
pkg install mysql55-server
pkg install lighttpd
pkg install git

Execute the following commands:
echo 'lighttpd_enable="YES"' >> /etc/rc.conf
echo 'mysql_enable="YES"' >> /etc/rc.conf
echo '[mysqld]' >> /var/db/mysql/my.cnf
echo 'skip-networking' >> /var/db/mysql/my.cnf
/usr/local/etc/rc.d/mysql-server start

Configure MySQL:
mysql_secure_installation
mysql -u root --password="YOURPASSWORD" -e "CREATE DATABASE spotweb;"
mysql -u root --password="YOURPASSWORD" -e "CREATE USER 'spotweb'@'localhost' IDENTIFIED BY 'spotweb';"
mysql -u root --password="YOURPASSWORD" -e "GRANT ALL PRIVILEGES ON spotweb.* TO spotweb @'localhost' IDENTIFIED BY 'spotweb';"

Configure Lighthttpd:
vi /usr/local/etc/lighttpd/lighttpd.conf

Edit the following:
var.server_root = "/usr/local/www/spotweb"
server.use-ipv6 = "disable"
server.bind = "192.168.178.6"
server.document-root = "/usr/local/www/spotweb"
$SERVER["socket"] == "192.168.178.6:80"

Add this to the bottom of the file:
$HTTP["url"] =~ "^/data/" {
     url.access-deny = ("")
   }

$HTTP["url"] =~ "^($|/)" {
     dir-listing.activate = "disable"
   }

cgi.assign = ( ".php" => "/usr/local/bin/php-cgi" )

Enable fast-cgi module by removing #:
vi /usr/local/etc/lighttpd/modules.conf

#include "conf.d/fastcgi.conf"

Edit fastcgi.conf:
vi /usr/local/etc/lighttpd/conf.d/fastcgi.conf

fastcgi.server = ( ".php" =>
  ((
    "socket" => "/tmp/php.socket",
    "bin-path" => "/usr/local/bin/php-cgi",
    "bin-environment" => (
      "PHP_FCGI_CHILDREN" => "16",
      "PHP_FCGI_MAX_REQUESTS" => "10000"
    ),
    "min-procs" => 1,
    "max-procs" => 1,
    "idle-timeout" => 20
  ))
)

Edit the lighttpd mime configuration by adding the following to the array:
vi /usr/local/etc/lighttpd/conf.d/mime.conf

".svg" => "image/svg+xml",
".xht" => "application/xhtml+xml",
".xhtml" =>  "application/xhtml+xml",
".woff" =>  "application/x-font-woff",
".svgz" => "image/svg+xml",

Optional, enable the API
vi /usr/local/etc/lighttpd/modules.conf

Change server.modules to:
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
#  "mod_auth",
#  "mod_evasive",
#  "mod_setenv",
#  "mod_usertrack",
)

vi /usr/local/etc/lighttpd/lighttpd.conf

Add, somewhere under "## Filename/File handling"
url.rewrite-once = ( "^/api\?(.*)" => "/index.php?page=newznabapi&$1" )

END Optional, enable the API

Test the Lighthttpd config:

lighttpd -t -f /usr/local/etc/lighttpd/lighttpd.conf

Edit php.ini-development and save as php.ini
vi /usr/local/etc/php.ini-development

date.timezone = "Europe/Amsterdam"

cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini

Start Ligthttpd
/usr/local/etc/rc.d/lighttpd start

Spotweb installation
mkdir /usr/local/www
cd /usr/local/www
git clone https://github.com/spotweb/spotweb.git
chown -R www:www spotweb

Run Spotweb installation and configuration:
http://192.168.178.6/install.php

Install php5-extensions using ports:
cd /usr/ports/lang/php5-extensions
make install clean

Add the following extensions to the default selection:
CURL
GD
GETTEXT
MBSTRING
MYSQL
OPENSSL
ZIP
ZLIB

Run retrieve for the first time:
cd /usr/local/www/spotweb
php retrieve.php --force

To update to latest version and run upgrade-db:
cd /usr/local/www/spotweb
git pull
php bin/upgrade-db.php
php retrieve.php