Raspberry Pi a Owncloud 5 HTTPS with Nginx

Warning : This article has been automatically translated by Bing Translate

Danger : This article has been automatically translated by Bing Translate

Caveat : This article has been automatically translated by Bing Translate


[Update 11/11/13] Tested and validated with the 5.0.13

With the latest version of Owncloud 5.0.6, the tutorial of the version 4 here needed details. Thanks to the many comments and to TEF, you are entitled to a tutorial updated ! 🙂


  1. Install the packages for the Nginx with PHP and the database server
    apt-get install nginx php5-fpm php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl3-dev php5-curl php5-common php-xml-parser sqlite php-apc

    It installs is apache2.2 and me I don't want ! 🙂

    apt - get remove apache2.2
  2. Download Owncloud. At the writing of this post, This is the version 5.0.6 the last dated.
     CD/var/www wget http://Download.owncloud.org/community/owncloud-5.0.6.tar.bz2
  3. Unpack the archive download
     tar jxvf owncloud - 5.0.6.tar.bz2
  4. Change the owner of the directory
     chown -R www-data:www - data/var/www/owncloud
  5. Create the directory /etc/nginx/certs If there is no
     mkdir /etc/nginx/certs
  6. Generate the certificates for the site. You must be in the directory /etc/nginx/certsAttention : use a strong password to generate your certificate. The certificate is valid 365 days. Need to generate a new one year
    cd /etc/nginx/certs
    openssl genrsa -des3 -out owncloud.key 1024
    openssl req -new -key owncloud.key -out owncloud.csr
    cp owncloud.key owncloud.key.org
    openssl rsa -in owncloud.key.org -out owncloud.key
    openssl x509 -req -days 365 -in owncloud.csr -signkey owncloud.key -out owncloud.crt
  7. Remove unnecessary file
    rm owncloud.csr owncloud.key.org
  8. Create a file /etc/nginx/sites-available/owncloud (You choose the port)
    server {
    listen 8091 ssl;
    ssl_certificate /etc/nginx/certs/owncloud.crt;
    ssl_certificate_key /etc/nginx/certs/owncloud.key;
    error_log /var/log/nginx/owncloud.log;
    access_log /var/log/nginx/owncloud.log;
    server_name owncloud;
    root /var/www/owncloud;
    client_max_body_size 10G; # set max upload size  fastcgi_buffers 64 4K;
    rewrite ^/caldav((/|$).*)$ /remote.php/caldav$1 last;
    rewrite ^/carddav((/|$).*)$ /remote.php/carddav$1 last;
    rewrite ^/webdav((/|$).*)$ /remote.php/webdav$1 last;
    index index.php;
    error_page 403 = /core/templates/403.php;
    error_page 404 = /core/templates/404.php;
    location ~ ^/(data|config|.ht|db_structure.xml|README) {
    deny all;
    location / {
    rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
    rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
    rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
    rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
    rewrite ^(/core/doc/[^/]+/)$ $1/index.html;
    try_files $uri $uri/ index.php;
    location ~ ^(?<script_name>.+?.php)(?<path_info>/.*)?$ {
    try_files $script_name = 404;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_pass unix:/var/run/PHP5-fpm.sock;
    fastcgi_split_path_info ^(.+.php)(/.*)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param HTTPS on;
    include fastcgi_params;
  9. Enable the site
    ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/owncloud
  10. Change the rights on the shared directory. My House is /Media/usbdrive/internet.
    chown -R www-data:www - data/media/usbdrive/internet
  11. Edit the file /etc/php5/fpm/php.ini to increase the size of files that can be sent
    upload_max_filesize = 700M
    post_max_size = 800M
  12. Restart NGINX and php5-fpm
    service nginx restart
    service php5-fpm restart
  13. Accessing Owncloud with https://<IP_du_Raspberry> :<port_in_the_configuration>/

    Affichage du certificat pour se connecter Ă  votre Owncloud

    Display of the certificate to connect to your Owncloud

  14. Simply follow the instructions on the screen

    Paramètres de configuration de Owncloud

    Owncloud configuration settings

So much for your cloud to date with the latest version. For future updates, you have access from the interface with the user admin, in the administration, While down.

Vérification de la version installée de Owncloud

If you have an update to, You can follow the official instructions that are here. Be careful because they make a difference between update (minor version change : 5.0.6 from 5.0.7) and upgrade (major version change : 5.0.6 from 5.1.0).

You may also like...