Installing Owncloud on lighttpd

From Fyzix
Jump to: navigation, search

Reference: http://doc.owncloud.org/server/5.0/admin_manual/installation/installation_others.html

Prerequisites

Dependencies: lighttpd, lighttpd-mod-fastcgi, php5-cgi, php5-zip and php5-gd

apt-get  install -y build-essential pkg-config libcurl4-openssl-dev  libsigc++-2.0-dev libncurses5-dev lighttpd nano screen 

apt-get install -y subversion  libterm-readline-gnu-perl php5-cgi apache2-utils libtool automake openssl 

apt-get install -y libcurl4-openssl-dev libssl-dev php5 php5-cgi php5-cli php5-common php5-curl php5-dev 

apt-get install -y php5-geoip php5-sqlite php5-xmlrpc

apt-get install -y libapache2-mod-fcgid spawn-fcgi psmisc

lighttpd-enable-mod fastcgi fastcgi-php

This is redundant.

apt-get  install -y build-essential pkg-config libcurl4-openssl-dev  libsigc++-2.0-dev libncurses5-dev lighttpd nano screen
apt-get install -y subversion libterm-readline-gnu-perl php5-cgi apache2-utils libtool automake openssl
apt-get install -y php5-cgi php5-cli php5-common php5-curl php5-dev php5-gd php-xml-parser php5-intl php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl
apt-get install -y libcurl4-openssl-dev libssl-dev libapache2-mod-fcgid spawn-fcgi psmisc

Install with apt-get

Install repo key

wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key
apt-key add - < Release.key

Add owncloud repo to sources.list

echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list 
update

Install package

apt-get install owncloud

Install from Source

Please note, the source is probably a newer version than what is described in this Wiki.

Fetch source

cd /source/
wget http://download.owncloud.org/community/owncloud-5.0.5.tar.bz2
bunzip2 owncloud-5.0.5.tar.bz2
tar xvf owncloud-5.0.5.tar

Move source to webroot /var/www/

cd /source/
mv owncloud /var/www


Configuration

Configure Owncloud to use mysql

create database ownclouddb;
grant index, create, select, insert, update, delete, alter, lock tables on ownclouddb.* to 'ownclouduser'@'localhost' identified by 'systemn8mxy4215';

Copy and paste into console

if [ -e /etc/lighttpd/conf-available/10-fastcgi-php5.conf ]; then
/usr/sbin/lighty-enable-mod fastcgi-php5
else
/usr/sbin/lighty-enable-mod fastcgi
fi

Force reload lighttpd

/etc/init.d/lighttpd force-reload

It is important to note that the .htaccess files used by ownCloud to protect the data folder are ignored by lighttpd, so you have to secure it by yourself, otherwise your owncloud.db database and user data are publicly readable even if directory listing is off. You need to add two snippets to your lighttpd configuration file:

Modify /etc/lighttpd/lighttpd.conf

Disable access to data folder:

$HTTP["url"] =^ "^/owncloud/data/" {
     url.access-deny = ("")
   }

Disable directory listing:

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

SSL

Create SSL certificates.

mkdir /etc/lighttpd/certs
cd /etc/lighttpd/certs
openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout lighttpd.pem -out lighttpd.pem

Fill in the proper information.

Next modify lighttpd.conf one last time to use SSL.

Paste the following code into lighttpd.conf.

$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem"
}

Reload the lighttpd daemon

/etc/init.d/lighttpd force-reload