Lighttpd Configuration for ownCloud 6 (and ownCloud 7)
2014-09-19
And so, as I was saying, I wanted to setup ownCloud.
For the record, I'm using Centos6, which is a few years old. The EPEL6 repository only provides ownCloud 4.5, so I needed to find owncloud6 somewhere else. So I've looked at:
Anyway, in the owncloud SRPM rebuild creates not only an owncloud-6.0.4-3.el6.noarch.rpm (which contains the ownCloud software itself), but also 3 packages for database backends:
First things first: install the packages:
For the record, the
The last thing you are required to perform is to change ownership of some writable files for lighttpd.
After tweaking php and restarting lighttpd, and provided that you have correctly made some generic configuration in lighttpd for php, https, to allow redirections, etc. you should now be able to:
It should be noted, that I've installed my ownCloud 6 instance in the very last days prior to the ownCloud 7 release. So, early September, I've picked the owncloud-7.0.2-2.fc20 SRPM from fedora koji build platform and rebuilt it for my Centos release. The package rebuild, package update (+ that
OwnCloud 7, beside the overall general improvement, fixes a few issues I had to patch up manually (most of fixes are already reported in the github) in ownCloud 6, so I strongly suggest upgrading to version 7. I still have some minor bugs in the contact app (categories don't seem to be correctly set all the time), ...
But honestly, for now...
It just works.
For the record, I'm using Centos6, which is a few years old. The EPEL6 repository only provides ownCloud 4.5, so I needed to find owncloud6 somewhere else. So I've looked at:
- The rebuilt-for-Centos Fedora 20 owncloud-6.0.4-3 package.
- Remi Collet repository, for up-to-date php stuff. In Remi's PHP we trust.
Anyway, in the owncloud SRPM rebuild creates not only an owncloud-6.0.4-3.el6.noarch.rpm (which contains the ownCloud software itself), but also 3 packages for database backends:
- owncloud-mysql-6.0.4-3.el6.noarch.rpm
- owncloud-postgresql-6.0.4-3.el6.noarch.rpm
- owncloud-sqlite-6.0.4-3.el6.noarch.rpm (I've picked this one, for what it's worth).
- owncloud-httpd-6.0.4-3.el6.noarch.rpm (for apache web server)
- owncloud-nginx-6.0.4-3.el6.noarch.rpm (for nginx web server, obviously)
Impossible !, you said ? Don't tell me what I can't do.
First things first: install the packages:
cd ~rpmbuild/RPMS/noarch && yum --enablerepo=remi localinstall owncloud-6.0.4-3.el6.noarch.rpm owncloud-sqlite-6.0.4-3.el6.noarch.rpmTo make things easier for me, I've also installed the
owncloud-httpdpackage to base my lighttpd configuration upon something known-working. The
owncloud-httpdpackage provides this file:
Alias /owncloud /usr/share/owncloud <Directory /usr/share/owncloud/> Options -Indexes <IfModule mod_authz_core.c> # Apache 2.4 Require local </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from ::1 </IfModule> ErrorDocument 404 /core/templates/404.php php_value upload_max_filesize 512M php_value post_max_size 512M php_value memory_limit 512M SetEnv htaccessWorking true RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] </Directory>If you read those lines (almost) one by one, you realize it is not that hard to translate them to lighttpd syntax. So considering I've dedicated a virtual host for ownCloud, here is, roughly, what my configuration
/etc/lighttpd/vhosts.d/owncloud.conffile is, with some additional comments just for you to understand it a bit more.
$SERVER["socket"] == ":443" { ssl.engine = "enable" # StartSSL CA certificate and intermediate certificate ssl.ca-file = "/etc/pki/tls/startcom.crt" # My own certificate, generated by startssl. ssl.pemfile = "/etc/pki/tls/MY_STARTSSL_CERT.pem" $HTTP["host"] == "host.domain.tld" { var.server_name = "host.domain.tld" # This does not really matter. server.document-root = "/srv/lighttpd/" + server_name server.name = server_name # Bind URL path to filesystem path. (Alias /owncloud /usr/share/owncloud) alias.url = ( "/owncloud/" => "/usr/share/owncloud/" ) # Disable indexes. (Options -Indexes) $HTTP["url"] =~ "^/owncloud($|/)" { dir-listing.activate = "disable" } $HTTP["url"] =~ "^/owncloud/data/" { url.access-deny = ("") } # Redirect / to /owncloud/ url.redirect = ( "^/(index.php|owncloud)?$" => "https://" + server_name + "/owncloud/" ) # Treat *everything* under remote.php as php. Not an option. $HTTP["url"] =~ "^/owncloud/remote.php/.*" { fastcgi.map-extensions = ( "" => ".php" ) } # Owncloud 404 page (ErrorDocument 404 /core/templates/404.php) server.error-handler-404 = "/owncloud/core/templates/404.php" # It looks like ownCloud also has a 403 handler. server.error-handler-403 = "/owncloud/core/templates/403.php" # Specific logfile accesslog.filename = log_root + "/" + server_name + "/access.log" } }This configuration file does not include the
php_valuedirectives implementation. This means that if you do not do anything about it, you won't be able to upload more than 2MB files. Out of laziness, I've decided to change the system-wide
/etc/php.ini. The changes are pretty straightforward, so I won't talk more about them here.
For the record, the
$HTTP["url"] =~ "^/owncloud/remote.php/.*" { fastcgi.map-extensions = ( "" => ".php" ) }blob is a fix for the (in)famous "Why, Ô, why the hell files ending with a 0 in their name fail to upload ???" bug. It was... tricky... to track, but the fix makes sense once you understand how lighty internally works. This bug will happen more than you think: the ownCloud android app splits big (as in "more than 10MiB") files... and the first chunk for a big
foofile, will be
foo-0, which will trigger that bug.
The last thing you are required to perform is to change ownership of some writable files for lighttpd.
chown -R lighttpd:lighttpd /etc/owncloud /var/lib/owncloudUnfortunately, this will be required every time you update the owncloud packages.
After tweaking php and restarting lighttpd, and provided that you have correctly made some generic configuration in lighttpd for php, https, to allow redirections, etc. you should now be able to:
- Create and share contact
- Use calendars
- Upload up-to-512MB files through the web interface.
It should be noted, that I've installed my ownCloud 6 instance in the very last days prior to the ownCloud 7 release. So, early September, I've picked the owncloud-7.0.2-2.fc20 SRPM from fedora koji build platform and rebuilt it for my Centos release. The package rebuild, package update (+ that
chownthingy -_-) and internal ownCloud upgrade went without any problem. The lighttpd configuration itself did not require any further tweaking.
OwnCloud 7, beside the overall general improvement, fixes a few issues I had to patch up manually (most of fixes are already reported in the github) in ownCloud 6, so I strongly suggest upgrading to version 7. I still have some minor bugs in the contact app (categories don't seem to be correctly set all the time), ...
But honestly, for now...
It just works.
Comments are closed
Flux RSS des commentaires de cet article
Comments are closed for this entry.