Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Owncloud and Lighttpd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Tue Sep 08, 2015 6:58 pm    Post subject: Owncloud and Lighttpd Reply with quote

The following is my journey to get Owncloud installed. I'm not a dev, I just have some understanding of linux. I will be using Owncloud on my home network and it will not have any outside network access.

After reading the owncloud wiki:
https://wiki.gentoo.org/wiki/Owncloud
I saw that there were 3 options for the webserver: nginx, apache and lighttpd, which was the order I tried them. I ended up using lighttpd. The following are the steps I took to get Owncloud working.

Installation
1. Add the following to package.accept_keywords: (for amd64)
Code:
app-admin/webapp-config ~amd64
dev-lang/php ~amd64
www-servers/lighttpd ~amd64
www-apps/owncloud ~amd64


2. Install webapp-config
A.
Code:
emerge -av webapp-config

B. Modify /etc/vhosts/webapp-config
From
Code:
vhost_server="apache"

To
Code:
vhost_server="lighttpd"


3. Install webserver lighttpd (default use -php)
Code:
emerge -av www-servers/lighttpd


4. Install Owncloud server
Code:
emerge -av www-apps/owncloud


5. Modify /etc/lighttpd/lighttpd.config
Uncomment the following
Code:
server.document-root = var.basedir + "/htdocs"
server.errorlog      = var.logdir  + "/error.log"
accesslog.filename   = var.logdir + "/access.log"
include "mod_fastcgi.conf"


6. Modify /etc/lighttpd/mod_fastcgi.conf
Use the following: (overwrite what is originally supplied)
Code:
server.modules += ("mod_fastcgi")
fastcgi.server = ( ".php" =>
  ( "localhost" =>
    (
      "host" => "127.0.0.1",
      "port" => "9000"
    )
  )
)


7. Modify /etc/php/fpm-php5.6/php.fpm.conf
A. Uncomment
Code:
listen = 127.0.0.1:9000
pm.start_servers = 20
error_log = /var/log/php-fpm.log

B. Change
From
Code:
;user = nobody
;group = nobody

To
Code:
user = yourclouduser
group = yourclouduser


8. Test lighttpd.conf (should return a 0)
Code:
lighttpd-angel -t -f /etc/lighttpd/lighttpd.conf


9. Add the following to /etc/php/fpm-php5.6/php.ini
Code:
date.timezone = America/New_York


10. Change ownership to lighttpd
Code:
chown -R lighttpd:lighttpd /var/www/localhost/


11. Change ownership to owncloud (Owncloud script, see below)
Execute owncloud.sh

12. Modify group
Add lighttpd to yourclouduser
yourclouduser:x:1001:lighttpd

13. Start lighttpd & php-fpm
Code:
rc-update add lighttpd default && rc-update add php-fpm default && /etc/init.d/php-fpm start && /etc/init.d/lighttpd start


14. Test lighttpd in browser (see below)
A. http://localhost/info.php
or
B. http://localhost/whoami.php

15. Restart

16. Owncloud setup
http://localhost/owncloud

17. Setup cron job
Code:
sudo crontab -u yourclouduser -e

*/15 * * * * php -f /var/www/localhost/htdocs/owncloud/cron.php

18. Install Owncloud client
Code:
emerge -av net-misc/owncloud-client


19. Change file handling size (Can't be changed in GUI due to Lighttpd)
Modify /var/www/localhost/htdocs/owncloud/user.ini
From
Code:
upload_max_filesize=513M
post_max_size=513M

To
Code:
upload_max_filesize=16G
post_max_size=16G



The following three files are to help setup Owncloud.

1. Owncloud script - change permissions for owncloud
Code:
#!/bin/bash
ocpath='/var/www/localhost/htdocs/owncloud'
htuser='yourclouduser'
htgroup='yourclouduser'

find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750

chown -R root:${htuser} ${ocpath}/
chown -R ${htuser}:${htgroup} ${ocpath}/apps/
chown -R ${htuser}:${htgroup} ${ocpath}/config/
chown -R ${htuser}:${htgroup} ${ocpath}/data/
chown -R ${htuser}:${htgroup} ${ocpath}/themes/

chown root:${htuser} ${ocpath}/.htaccess
chown root:${htuser} ${ocpath}/data/.htaccess

chmod 0644 ${ocpath}/.htaccess
chmod 0644 ${ocpath}/data/.htaccess


2. /var/www/localhost/htdocs/info.php - PHP info
Code:
<?php phpinfo(); ?>


3. /var/www/localhost/htdocs/whoami.php - Tells who is the current group and user for Owncloud
Code:
<?php
echo "User: " . exec('whoami');
echo "Group: " . exec('groups');
?>


It is recommended that you setup a group/user to use for Owncloud. I have shown that as yourclouduser.

Upgrades
After portage upgrades Owncloud make the following adjustments:
1. Update config
Code:
sudo CONFIG_PROTECT="/var/www/localhost/htdocs/owncloud//" etc-update


2. Run Owncloud upgrade - Open Owncloud via browser and after login an update process will be presented.

3. Change file handling size - see step #19 of installation.

4. Re-enable app's

History
I tried all three webservers but could only get lighttpd to work fully.

URL's
https://wiki.gentoo.org/wiki/Owncloud
https://wiki.gentoo.org/wiki/Lighttpd
https://wiki.gentoo.org/wiki/PHP
https://wiki.gentoo.org/wiki/Webapp-config
https://doc.owncloud.org/server/8.1/admin_manual/installation/installation_wizard.html
https://doc.owncloud.org/server/5.0/admin_manual/configuration/background_jobs.html#cron-jobs

Update
9/16/15 - Added file handling size.
9/26/15 - Added cron job, Owncloud client and upgrade info.


Last edited by davidbrooke on Sat Sep 26, 2015 3:00 pm; edited 9 times in total
Back to top
View user's profile Send private message
beerbellyswan
Tux's lil' helper
Tux's lil' helper


Joined: 01 May 2004
Posts: 128
Location: mendon, ny

PostPosted: Tue Sep 15, 2015 2:41 pm    Post subject: Reply with quote

well done - this cheatsheet is fantastic. i struggled with the apache installation for so long that i gave up - but this lighttpd implementation works like a charm. nice work
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Sat Sep 19, 2015 1:01 pm    Post subject: Reply with quote

I'm having a problem implementing the document collaboration. I have posted the issue on the Owncloud forums:
https://forum.owncloud.org/viewtopic.php?f=31&t=30538
Any help would be appreciated.
Thanks
Back to top
View user's profile Send private message
davidbrooke
Guru
Guru


Joined: 03 Jan 2015
Posts: 341

PostPosted: Tue Sep 22, 2015 12:15 am    Post subject: Reply with quote

I have posted a bug per the request of the Owncloud forums admin:
https://github.com/owncloud/documents/issues/551
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum