Raspberry Pi and Owncloud HTTPS with Nginx

If you want to install this service, You'll find dozens (at least) tutorials with your friend Google. So here I'll do easy and quick to share a USB Internet drive partition all in HTTPS !

Raspberry Pi Home Server - Etape 14 : installer Owncloud en HTTPS avec Nginx

The tutorials to install Owncloud you therefore find everywhere (you have an excellent and simple on tropfacile.NET). So one more on this site ! 🙂 On va installer Owncloud pour pouvoir partager une partition the USB disk. We will also see the certificate management to make an HTTPS connection.

  1. Install the necessary packages
    apt - get install php5 php5-json php5-gd php5-sqlite curl libcurl3 libcurl3-dev php5-curl php5-common php-xml-parser sqlite
  2. Package php - apc for optimizer performance (Thank you forum raspberrypi.org)
    apt - get install php - apc
  3. Download OwnCloud
    http://doc.owncloud.org/server/5.0/admin_manual/
  4. Unpack the archive in/var/www
    CD/var/www tar jxvf <Archive>
  5. Change the owner of the directory
    chown -R www-data:www - data/var/www/owncloud
  6. Create the directory /etc/nginx/certs If there is no
    mkdir /etc/nginx/certs
  7. Generate the certificate for the site 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
    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
  8. Remove unnecessary file
    rm owncloud.csr owncloud.key.org
  9. Create a file /etc/nginx/sites-available/owncloud (You choose the port)
    server {
    
     listen 8091 ssl;
    
     SSL on;
    
     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;
    
     index index.php;
    
     client_max_body_size 1000M;
    
    # deny direct access rental ~ ^ /.(data|config|.ht|db_structure.xml|README) {
    
     deny all;
    
     }
    
     # default try order rental / {
    
     try_files $uri $uri / @webdav;
    
     }
    
     # owncloud WebDAV rental @webdav {
    
     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;
    
     }
    
    location ~ .php$ {
    
     include/etc/nginx/fastcgi_params;
    
     try_files $uri = 404;
    
     fastcgi_param HTTPS on;
    
     fastcgi_index index.php;
    
     fastcgi_split_path_info ^(.+.php)(/.+)$;
    
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
     fastcgi_pass unix:/var/run/PHP5-fpm.sock;
    
     }
    
     }
  10. Enable the site
    ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/owncloud
  11. Change the rights on the shared directory
    chown -R www-data:www - data/media/usbdrive/internet
  12. 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
  13. Restart NGINX and php5-fpm
    service nginx restart
    
    service php5-fpm restart
  14. Accessing Owncloud with https://<IP_du_Raspberry> :<port_in_the_configuration>/

    Display of the certificate to connect to your Owncloud

    Display of the certificate to connect to your Owncloud

  15. Simply follow the instructions on the screen

    Owncloud configuration settings

    Owncloud configuration settings

  16. Appointment on http://owncloud.org/support/ for documentation on the use of Owncloud
  17. A quick tour of your directory of data will confirm that the data will be stored in the right place

Here I hope to have helped you in your installation.

Good evening


For the version 5.0.4, Thanks to EFT (its site here) for his help :

    1. the name of the server (caution it appears in two places) –> server_name owncloud;
    2. the ssl port-> listen 8091 ssl;
    3. the location and the name of certificates :
      • –> ssl_certificate /etc/nginx/certs/owncloud.crt;
      • –> ssl_certificate_key /etc/nginx/certs/owncloud.key;
    4. the root-> root /var/www/owncloud;

You may also like...