Skip to content

Commit a046210

Browse files
docs(installation): reorganize Apache source installation guidance
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent ff2d332 commit a046210

1 file changed

Lines changed: 104 additions & 93 deletions

File tree

admin_manual/installation/source_installation.rst

Lines changed: 104 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Installation on Linux
44

55
There are multiple ways of installing Nextcloud depending on your preferences, requirements and goals.
66

7+
If you prefer installing from the source tarball, you can deploy Nextcloud
8+
from scratch using a classic LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack.
9+
10+
The :ref:`manual_installation_label` section provides a complete walk-through
11+
for installing Nextcloud for use with Apache and MariaDB, using `the Nextcloud
12+
.tar archive <https://nextcloud.com/install/>`_. Usage with other web servers
13+
(e.g. Nginx) and database backends are also covered.
14+
715
If you prefer an automated installation, you have the option to:
816

917
* use the `official Nextcloud installation method <https://github.com/nextcloud/all-in-one#nextcloud-all-in-one>`_. Nextcloud AIO provides easy deployment and maintenance with most features included in this one Nextcloud instance. It includes Office, a turnkey Backup solution, Imaginary (for previews of heic, heif, illustrator, pdf, svg, tiff and webp) and more.
@@ -16,74 +24,54 @@ If you prefer an automated installation, you have the option to:
1624

1725
.. tip:: For an enterprise-ready and scalable installation based on Helm Charts (also available for Podman), please `contact Nextcloud GmbH <https://nextcloud.com/enterprise/>`_.
1826

19-
In case you prefer installing from the source tarball, you can setup Nextcloud
20-
from scratch using a classic LAMP stack (Linux, Apache, MySQL/MariaDB, PHP).
21-
This document provides a complete walk-through for installing Nextcloud on
22-
Ubuntu 24.04 LTS Server with Apache and MariaDB, using `the Nextcloud .tar
23-
archive <https://nextcloud.com/install/>`_. This method is recommended to install Nextcloud.
24-
25-
This installation guide is giving a general overview of required dependencies and their configuration. For a distribution specific setup guide have a look at the :doc:`./example_ubuntu` and :doc:`./example_centos`.
27+
.. _manual_installation_label:
2628

27-
.. _prerequisites_label:
29+
Manual Installation
30+
===================
2831

32+
This installation guide is giving a general overview of required dependencies
33+
and their configuration. For distribution specific setup guide have a look at
34+
the :doc:`./example_ubuntu`, :doc:`./example_centos`, etc.
2935

30-
.. note:: Admins of SELinux-enabled distributions such as CentOS, Fedora, and
31-
Red Hat Enterprise Linux may need to set new rules to enable installing
32-
Nextcloud. See :ref:`selinux_tips_label` for a suggested configuration.
36+
.. _prerequisites_label:
3337

34-
Prerequisites for manual installation
35-
-------------------------------------
38+
Prerequisites
39+
-------------
3640

3741
The Nextcloud .tar archive contains all of the required PHP modules.
3842
Your Linux distribution should have packages for all required modules.
3943
See :doc:`php_configuration` for a list of required and suggested modules.
4044

41-
You don’t need the WebDAV module for your Web server (i.e. Apache’s
42-
``mod_webdav``), as Nextcloud has a built-in WebDAV server of its own,
43-
SabreDAV.
44-
If ``mod_webdav`` is enabled you must disable it for Nextcloud. (See
45-
:ref:`apache_configuration_label` for an example configuration.)
45+
.. note:: If your web server includes a WebDAV module of its own, make sure
46+
to disable it so that it does not interfere with Nextcloud's own WebDAV
47+
server.
48+
49+
.. note:: Admins of SELinux-enabled distributions such as CentOS, Fedora, and
50+
Red Hat Enterprise Linux may need to set new rules to enable installing
51+
Nextcloud. See :ref:`selinux_tips_label` for a suggested configuration.
4652

4753
.. _apache_configuration_label:
4854

4955
Apache Web server configuration
5056
-------------------------------
5157

52-
Configuring Apache requires the creation of a single configuration
53-
file. On Debian, Ubuntu, and their derivatives, this file will be
54-
:file:`/etc/apache2/sites-available/nextcloud.conf`. On Fedora,
55-
CentOS, RHEL, and similar systems, the configuration file will be
56-
:file:`/etc/httpd/conf.d/nextcloud.conf`.
57-
58-
You can choose to install Nextcloud in a directory on an existing
59-
webserver, for example `https://www.example.com/nextcloud/`, or in a
60-
virtual host if you want Nextcloud to be accessible from its own
61-
subdomain such as `https://cloud.example.com/`.
62-
63-
To use the directory-based installation, put the following in your
64-
:file:`nextcloud.conf` replacing the **Directory** and **Alias** filepaths
65-
with the filepaths appropriate for your system::
66-
67-
Alias /nextcloud "/var/www/nextcloud/"
58+
For Apache-based deployments, we recommend serving Nextcloud from its own
59+
virtual host, for example ``https://cloud.example.com/``. Installing
60+
Nextcloud in a subdirectory of an existing site, for example
61+
``https://www.example.com/nextcloud/``, is also supported.
6862

69-
<Directory /var/www/nextcloud/>
70-
Require all granted
71-
AllowOverride All
72-
Options FollowSymLinks MultiViews
73-
74-
<IfModule mod_dav.c>
75-
Dav off
76-
</IfModule>
77-
</Directory>
63+
Nextcloud ships with a ``.htaccess`` file containing Apache-specific
64+
rules. In most cases, it is sufficient to configure the virtual host and
65+
allow overrides so Apache can apply the rules from Nextcloud's
66+
``.htaccess`` file.
7867

79-
To use the virtual host installation, put the following in your
80-
:file:`nextcloud.conf` replacing **ServerName**, as well as the
81-
**DocumentRoot** and **Directory** filepaths with values appropriate
82-
for your system::
68+
The following example shows a minimal Apache virtual host
69+
configuration. Replace ``ServerName``, ``DocumentRoot``, and
70+
``Directory`` with values appropriate for your system::
8371

8472
<VirtualHost *:80>
8573
DocumentRoot /var/www/nextcloud/
86-
ServerName your.server.com
74+
ServerName cloud.example.com
8775

8876
<Directory /var/www/nextcloud/>
8977
Require all granted
@@ -96,81 +84,81 @@ for your system::
9684
</Directory>
9785
</VirtualHost>
9886

87+
When using SSL/TLS, make sure that the Apache ``ServerName`` matches
88+
the hostname clients use to reach Nextcloud and that your certificate
89+
is valid for that hostname.
9990

100-
On Debian, Ubuntu, and their derivatives, you should run the following
101-
command to enable the configuration::
91+
On Debian, Ubuntu, and their derivatives, save this configuration as
92+
:file:`/etc/apache2/sites-available/nextcloud.conf` and enable it with::
10293

10394
a2ensite nextcloud.conf
10495

96+
On Fedora, CentOS, RHEL, and similar systems, save the configuration as
97+
:file:`/etc/httpd/conf.d/nextcloud.conf`.
10598

106-
Additional Apache configurations
107-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99+
If you prefer to install Nextcloud in a subdirectory of an existing
100+
site, use an ``Alias``-based configuration such as the following,
101+
adjusting the paths for your system::
108102

109-
**Required modules:**
103+
Alias /nextcloud "/var/www/html/nextcloud/"
110104

111-
* For Nextcloud to work correctly, we need the module ``mod_rewrite``. Enable
112-
it by running::
105+
<Directory /var/www/html/nextcloud/>
106+
Require all granted
107+
AllowOverride All
108+
Options FollowSymLinks MultiViews
113109

114-
a2enmod rewrite
110+
<IfModule mod_dav.c>
111+
Dav off
112+
</IfModule>
113+
</Directory>
115114

116-
* If you're using ``mod_fcgi`` or ``php-fpm`` (PHP FastCGI Process Manager),
117-
you must enable the proxy modules::
115+
If you have configured authentication for a parent directory, disable it
116+
for the Nextcloud location. Following the examples above, add the
117+
following line to the ``<Directory>`` section::
118118

119-
a2enmod proxy
120-
a2enmod proxy_fcgi
119+
Satisfy Any
121120

122-
**Recommended modules** are ``mod_headers``, ``mod_env``, ``mod_dir`` and ``mod_mime``::
121+
For more information about Apache virtual host layouts and other
122+
general Apache configuration patterns, see the Apache HTTP Server
123+
documentation.
124+
125+
Additional Apache configurations
126+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127+
128+
Enable the following required module::
129+
130+
a2enmod rewrite
131+
132+
Recommended modules are ``mod_headers``, ``mod_env``, ``mod_dir``, and
133+
``mod_mime``::
123134

124135
a2enmod headers
125136
a2enmod env
126137
a2enmod dir
127138
a2enmod mime
128139

129-
If you're running ``mod_fcgi`` instead of the standard ``mod_php`` also enable::
140+
After making your changes, restart Apache::
130141

131-
a2enmod setenvif
142+
service apache2 restart
132143

133-
and apply the following modifications to the configuration::
144+
If Nextcloud is installed in a subdirectory and you want to use CalDAV
145+
or CardDAV clients, configure the correct
146+
:ref:`service-discovery-label` URLs.
134147

135-
ProxyFCGIBackendType FPM
136-
137-
<FilesMatch remote.php>
138-
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
139-
</FilesMatch>
148+
If you are using ``php-fpm`` or ``mod_fcgi``, see
149+
:ref:`php_fpm_tips_label` for additional Apache configuration.
140150

141151
**Verifying modules are enabled:**
142152

143153
To verify that required modules are enabled, use the ``apache2ctl`` command::
144154

145-
apache2ctl -M | grep -E "rewrite|proxy|proxy_fcgi"
155+
apache2ctl -M | grep -E "rewrite|headers|env|dir|mime"
146156

147157
If you see matching output for the modules you've enabled, they are active.
148158
If any required module is missing, troubleshoot your OS package manager to
149159
ensure the Apache modules are installed (package names may vary by distribution;
150160
for example, on Debian/Ubuntu look for ``libapache2-mod-fcgid`` or similar).
151161

152-
* You must disable any server-configured authentication for Nextcloud, as it
153-
uses Basic authentication internally for DAV services. If you have turned on
154-
authentication on a parent folder (via e.g. an ``AuthType Basic``
155-
directive), you can turn off the authentication specifically for the
156-
Nextcloud entry. Following the above example configuration file, add the
157-
following line in the ``<Directory>`` section::
158-
159-
Satisfy Any
160-
161-
* When using SSL, take special note of the ServerName. You should specify one
162-
in the server configuration, as well as in the CommonName field of the
163-
certificate. If you want your Nextcloud to be reachable via the internet,
164-
then set both of these to the domain you want to reach your Nextcloud server.
165-
166-
* Now restart Apache::
167-
168-
service apache2 restart
169-
170-
* If you're running Nextcloud in a subdirectory and want to use CalDAV or
171-
CardDAV clients make sure you have configured the correct
172-
:ref:`service-discovery-label` URLs.
173-
174162
.. _pretty_urls_label:
175163

176164
Pretty URLs
@@ -181,7 +169,9 @@ in sharing links like ``https://example.org/nextcloud/index.php/s/Sv1b7krAUqmF8Q
181169
making URLs shorter and thus prettier.
182170

183171
``mod_env`` and ``mod_rewrite`` must be installed on your webserver and the :file:`.htaccess`
184-
must be writable by the HTTP user. To enable ``mod_env`` and ``mod_rewrite``, run ``sudo a2enmod env`` and ``sudo a2enmod rewrite``. Then you can set in the :file:`config.php` two variables::
172+
must be writable by the HTTP user. To enable ``mod_env`` and ``mod_rewrite``, run
173+
``sudo a2enmod env`` and ``sudo a2enmod rewrite``. Then you can set in the :file:`config.php`
174+
two variables::
185175

186176
'overwrite.cli.url' => 'https://example.org/nextcloud',
187177
'htaccess.RewriteBase' => '/nextcloud',
@@ -290,6 +280,27 @@ SELinux-enabled distributions such as Fedora and CentOS.
290280
PHP-FPM configuration
291281
---------------------
292282

283+
Apache integration
284+
^^^^^^^^^^^^^^^^^^
285+
286+
* If you're using ``mod_fcgi`` or ``php-fpm`` (PHP FastCGI Process Manager),
287+
you must enable the proxy modules::
288+
289+
a2enmod proxy
290+
a2enmod proxy_fcgi
291+
292+
If you're running ``mod_fcgi`` instead of the standard ``mod_php`` also enable::
293+
294+
a2enmod setenvif
295+
296+
and apply the following modifications to the configuration::
297+
298+
ProxyFCGIBackendType FPM
299+
300+
<FilesMatch remote.php>
301+
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
302+
</FilesMatch>
303+
293304
Overview
294305
^^^^^^^^
295306

0 commit comments

Comments
 (0)