Enable external access to your ownCloud Raspberry Pi server


Once you’ve set up an ownCloud server on your Raspberry Pi, you’ll want to make it accessible over the internet from anywhere and not just from devices on your local network.

This process involves three steps: enable SSL, forward the ports on your router, and (optionally) configure a dynamic DNS URL that will point to your network’s public IP address.

1. Enable SSL

Although you can access your ownCloud server via HTTP, it is recommended that you use HTTPS. To do this, you will need to enable Secure Sockets Layer (SSL) for your server.

On the Raspberry Pi running your ownCloud server, open a Terminal window and enter:

sudo a2enmod ssl

Create a directory for the self-signed SSL certificate:

sudo mkdir /etc/apache2/ssl

You need to create the certificate and the server key that protects it, and then place them both in the new directory. To do this, enter this command (all on one line):

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout 
/etc/apache2/ssl/owncloud.key -out /etc/apache2/ssl/owncloud.crt

You will be asked to enter the two letter code for your country, for example US, CA or GB. See the list of SSL country codes for more details. Then enter a state or province name, a locality / city and some organizational details (you can leave these fields empty), as well as an e-mail address.

To configure the certificate, you must modify the configuration file. To open it, enter:

sudo nano /etc/apache2/sites-available/default-ssl.conf

Change the Server Admin line email address webmaster | @localhost cheers. Add the following line below, replacing with its IP address:

ServerName :443

Change the Document root directory to / var / www / html / owncloud

Edit the following lines to point to your certificate and SSL key:

SSLCertificateFile /etc/apache2/ssl/owncloud.crt
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key

hurry Ctrl + X then Yes to exit and save the file.

Activate the new virtual host with:

sudo a2ensite default-ssl

Restart the Apache web server:

sudo service apache2 restart

2. Configure port forwarding

To enable external connections from outside your local network to your ownCloud Raspberry Pi server, you will need to configure port forwarding.

To do this, go to your wireless router’s settings page in a web browser. Many routers use the 192.168 IP address. 1.1 or for this page, but others use a different address such as If you are not sure, it is possible to find the IP address of your wireless router.

Read more: How to find your router’s IP address

Once in the router settings, you can usually find the port forwarding settings in the Firewall section. You may need to access Advanced (or Expert) Settings to achieve this.

Forward Router Ports

Forward ports 80 (HTTP) and 443 (HTTPS) to your ownCloud Raspberry Pi server, using its IP address. The latter can be found in the list of devices in the router settings, or by hovering over the Wi-Fi icon on the Raspberry Pi desktop.

3. Obtain a dynamic DNS address

FreeDNS Home Page

Dynamic DNS Service (DDNS) allows you to use a subdomain to visit your ownCloud server instead of your router’s public IP address.

By using a DDNS client on a device or the router, it is also possible to automatically update the subdomain if the public IP address of your router changes.

One of the many providers of DDNS is FreeDNS. Visit freedns.afraid.org and create a free account that will allow you to create up to five subdomains.

Once connected to FreeDNS, select Subdomains and choose to add one. Select one of the available free domains (we chose chickenkiller.com) and enter an appropriate subdomain name (we used philcloud).

Point it to the public IP address of your home network; to find it, do a Google search for “What is my IP”. With all the details filled in, click on to save.

3. Complete the ownCloud configuration

Back on the Raspberry Pi, you will need to add your home network’s public IP address and DDNS subdomain to the list of trusted IP addresses.

Open the ownCloud configuration file:

sudo nano /var/www/owncloud/config/config.php

Below the starting line 0 =>, enter the following (indented at the same level), replacing with the public IP address of your network and with the subdomain you configured:

1 => '',
2 => '

hurry Ctrl + X then Yes to exit and save the file.

Now, to access your ownCloud server on any device, visit your new DDNS subdomain (or public IP address) followed by / owncloud.

OwnCloud Server Dashboard

If you see a warning that your connection is not private or secure, you can choose to ignore it (by selecting Advanced in Chrome or Firefox) and access the site using HTTP instead.

Your ownCloud server is ready for external access

By visiting the subdomain you configured in a web browser, you should now be directed to the ownCloud server running on your Raspberry Pi. You can also access it from outside your local network.

Raspberry Pi Static IP Router
How to set a static IP address on Raspberry Pi?

If you are using your Raspberry Pi as a media or game server, setting a static IP address will make things a lot easier.

Read more

About the Author

Source link


Comments are closed.