Configure Apache for Manual Installation on Linux
This document describes the basic configuration of your Apache webserver for the use with ownCloud. It assumes that you already have successfully installed the Apache Webserver. Please read the Apache Documentation for more or enhanced configuration options.
On Debian, Ubuntu, and their derivatives, Apache installs with a useful configuration.
All you have to do is create an
/etc/apache2/sites-available/owncloud.conf file with these lines in it,
replacing the Directory and other file paths with your own file paths:
Alias /owncloud "/var/www/owncloud/"
Then create a symlink to /etc/apache2/sites-enabled:
sudo ln -s /etc/apache2/sites-available/owncloud.conf /etc/apache2/sites-enabled/owncloud.conf
For ownCloud to work correctly, you need the module
mod_rewrite. Enable it by running:
a2enmod rewrite. Additionally recommended modules are
mod_unique_id. To enable them, run the following commands:
sudo a2enmod headers sudo a2enmod env sudo a2enmod dir sudo a2enmod mime sudo a2enmod unique_id
You must disable any server-configured authentication for ownCloud since it uses basic authentication internally for DAV services. If you have turned on authentication on a parent folder (e.g. via an
AuthType Basicdirective), you can disable the authentication specifically for the ownCloud entry. As in the above example configuration file, add the following line in the
When using SSL, take special note of the
ServerName. You should specify one in the server configuration as well as in the
CommonNamefield of the certificate. If you want your ownCloud to be reachable via the internet, set both of these to the domain for your ownCloud server.
Now restart Apache
sudo service apache2 restart
If you’re running ownCloud in a sub-directory and want to use CalDAV or CardDAV clients, make sure you have configured the correct Service Discovery URLs.
The use of
mod_unique_id enables an administrator to trace requests via logfiles.
|mod_unique_id provides a magic token for each request which is guaranteed to be unique across "all" requests under very specific conditions.
If you enable the module, there is nothing else you have to do as ownCloud automatically includes the
UNIQUE_ID environment variable, provided by the module, in ownCloud’s log file.
To confirm that it’s working, check that the
UNIQUE_ID environment variable is being set by running
phpinfo() (like in the screenshot below).
Next, compare the value set for
UNIQUE_ID in the output of
phpinfo() with the value in ownCloud’s log file to ensure that they’re the same. In the example below, you can see an example log entry, where ownCloud is logging the unique id provided by Apache as the value for the first key
reqId in the record.
You can use ownCloud over plain HTTP, but we strongly encourage you to use SSL/TLS to encrypt all of your server traffic and to protect users’ logins and data in transit.
You can install any purchased or free certificate like the ones via Let’s Encrypt.
Read Using Let’s Encrypt SSL Certificates if you want to use free of charge certificates for Apache.
Apache installed on an Ubuntu system comes already set up with a simple self-signed certificate.
|Self-signed certificates have their drawbacks - especially when you plan to make your ownCloud server publicly accessible. You may want to consider getting a certificate signed by a commercial signing authority or a free certificate like the ones from Let’s Encrypt.
Using the simple self-signed certificate provided by the Apache installation, all you have to do is to enable the
ssl module and the default site. Open a terminal and run:
sudo a2enmod ssl
sudo a2ensite default-ssl
sudo service apache2 reload
If you want to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space. ownCloud limits its support to Apache prefork only.
In case you have enabled