Running ownCloud with httpd on OpenBSD

Alex Holst edited this page Feb 13, 2018 · 29 revisions

Installing ownCloud (or Nextcloud) on OpenBSD

Install it from the ports tree or use a prebuilt package:

# pkg_add owncloud

Then install PHP-FPM as it doesn't come with previous package. First find out your PHP version:

$ pkg_info -I php
php-5.5.22  server-side HTML-embedded scripting language

And then install the matching php-fpm package:

# pkg_add php-fpm
quirks-2.54 signed on 2015-03-09T11:04:08Z
Ambiguous: choose package for php-fpm
a       0: <None>
        1: php-fpm-5.3.29p1
        2: php-fpm-5.4.38
        3: php-fpm-5.5.22
        4: php-fpm-5.6.5
Your choice: 3
php-fpm-5.5.22: ok

Read the installation instructions in /usr/local/share/doc/pkg-readmes/owncloud-7.0.4. Mind that version number in the path above (in this case, 7.0.4) may differ.

httpd(8) configuration

Skip the section about nginx(8) and configure /etc/httpd.conf for httpd(8) instead. Put this in your /etc/httpd.conf:

# IP or interface to listen on. You can use * to listen everywhere.
# egress is an alias for the default route interface.
ext_if="egress"

types { include "/usr/share/misc/mime.types" }

server "owncloud.example.com" {
        listen on $ext_if port 80
        listen on $ext_if tls port 443
        directory index "index.php"
        root "/owncloud"

        # Set max upload size to 513M (in bytes)
        connection max request body 537919488

        # First deny access to the specified files
        location "/db_structure.xml" { block }
        location "/.ht*"             { block }
        location "/README"           { block }
        location "/data*"            { block }
        location "/config*"          { block }

        location "/*.php*" {
                fastcgi socket "/run/php-fpm.sock"
        }
}

Mind that it relies on certificate path being /etc/ssl/server.crt and key path being /etc/ssl/private/server.key. If you want to customize paths, provide them in a separate tls block inside the server directive:

server "owncloud.example.com" {
        listen on $ext_if port 80
        listen on $ext_if tls port 443

        tls {
            certificate "/etc/ssl/example.crt"
            key "/etc/ssl/private/example.key"
        }
        
        # ...
}

See another guide if you want HTTP version to redirect to HTTPS version.

Limitations

The following optional features are not supported:

Running

# /etc/rc.d/php_fpm start
# /etc/rc.d/httpd start

Don't forget to start them on boot. To do that, add the following directive (or append to it) in /etc/rc.conf.local:

pkg_scripts="php_fpm httpd"

Using from Android

The Android owncloud app has a known problem with not downloading files with chunked encoding, which httpd uses. (Tracked as issue #1128.)

Using from iOS

iOS ownCloud app can access the server without problems. For example, to test it with the default root user, open the app and enter your URL and credentials:

The calendar integration works with CalDAV. Use some guide to set it up. Credentials are as follows:

Installing Owncloud using Puppet

Owncloud on OpenBSD now can be installed using Puppet and a single manifest.

Vagrantfile is also provided.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.