diff --git a/admin_manual/configuration_server/security_setup_warnings.rst b/admin_manual/configuration_server/security_setup_warnings.rst index 51bd96989..e74f077f6 100644 --- a/admin_manual/configuration_server/security_setup_warnings.rst +++ b/admin_manual/configuration_server/security_setup_warnings.rst @@ -59,7 +59,7 @@ describe how to enable HTTPS on the Apache and Nginx Web servers. :ref:`use_https_label` -:doc:`../installation/nginx_examples` +:doc:`../installation/nginx` The test with getenv(\"PATH\") only returns an empty response ------------------------------------------------------------- diff --git a/admin_manual/installation/index.rst b/admin_manual/installation/index.rst index c51bb8947..474549676 100644 --- a/admin_manual/installation/index.rst +++ b/admin_manual/installation/index.rst @@ -13,5 +13,4 @@ Installation apps_management_installation apps_supported selinux_configuration - nginx_examples nginx diff --git a/admin_manual/installation/nginx.rst b/admin_manual/installation/nginx.rst index f313bd75b..00c7caafa 100644 --- a/admin_manual/installation/nginx.rst +++ b/admin_manual/installation/nginx.rst @@ -2,12 +2,25 @@ Nginx Configuration =================== -The following configuration should be used when Nextcloud is placed in the -webroot of your Nginx installation. Be careful about line breaks if you copy -the examples, as long lines may be broken for page formatting. +This page covers example Nginx configurations to use with running an Nextcloud +server. This page is community-maintained. (Thank you, contributors!) -Some environments might need a ``cgi.fix_pathinfo`` set to ``1`` in their -``php.ini``. +- You need to insert the following code into **your Nginx configuration file.** +- Adjust **server_name**, **root**, **ssl_certificate** and + **ssl_certificate_key** to suit your needs. +- Make sure your SSL certificates are readable by the server (see `nginx HTTP + SSL Module documentation `_). +- ``add_header`` statements are only taken from the current level and are not + cascaded from or to a different level. All necessary ``add_header`` + statements must be defined in each level needed. For better readability it + is possible to move *common* add header statements into a separate file + and include that file wherever necessary. However, each ``add_header`` + statement must be written in a single line to prevent connection problems + with sync clients. +- Be careful about line breaks if you copy the examples, as long lines may be + broken for page formatting. +- Some environments might need a ``cgi.fix_pathinfo`` set to ``1`` in their + ``php.ini``. Thanks to `@josh4trunks `_ for providing / creating these configuration examples. @@ -15,8 +28,9 @@ creating these configuration examples. Nextcloud in the webroot of nginx --------------------------------- -The following config should be used when Nextcloud is placed in the webroot of -your nginx installation. +The following configuration should be used when Nextcloud is placed in the +webroot of your nginx installation. In this example it is +``/var/www/nextcloud`` and it is accessed via ``http(s)://cloud.example.com`` .. code-block:: nginx @@ -273,4 +287,43 @@ your nginx installation. } } } - + +Tips and Tricks +--------------- + +Suppressing Log Messages +======================== + +If you're seeing meaningless messages in your logfile, for example ``client +denied by server configuration: /var/www/data/htaccesstest.txt``, add this section to +your nginx configuration to suppress them: + +.. code-block:: nginx + + location = /data/htaccesstest.txt { + allow all; + log_not_found off; + access_log off; + } + +JavaScript (.js) or CSS (.css) files not served properly +======================================================== + +A common issue with custom nginx configs is that JavaScript (.js) +or CSS (.css) files are not served properly leading to a 404 (File not found) +error on those files and a broken webinterface. + +This could be caused by the: + +.. code-block:: nginx + + location ~* \.(?:css|js)$ { + +block shown above not located **below** the: + +.. code-block:: nginx + + location ~ \.php(?:$|/) { + +block. Other custom configurations like caching JavaScript (.js) +or CSS (.css) files via gzip could also cause such issues. diff --git a/admin_manual/installation/nginx_examples.rst b/admin_manual/installation/nginx_examples.rst deleted file mode 100644 index d5974d088..000000000 --- a/admin_manual/installation/nginx_examples.rst +++ /dev/null @@ -1,75 +0,0 @@ -============================ -Nginx Example Configurations -============================ - -This page covers example Nginx configurations to use with running an Nextcloud -server. This page is community-maintained. (Thank you, contributors!) - - -- You need to insert the following code into **your Nginx configuration file.** -- The configuration assumes that Nextcloud is installed in - ``/var/www/nextcloud`` and that it is accessed via - ``http(s)://cloud.example.com``. -- Adjust **server_name**, **root**, **ssl_certificate** and - **ssl_certificate_key** to suit your needs. -- Make sure your SSL certificates are readable by the server (see `nginx HTTP - SSL Module documentation `_). -- ``add_header`` statements are only taken from the current level and are not - cascaded from or to a different level. All necessary ``add_header`` - statements must be defined in each level needed. For better readability it - is possible to move *common* add header statements into a separate file - and include that file wherever necessary. However, each ``add_header`` - statement must be written in a single line to prevent connection problems - with sync clients. - -Example Configurations ----------------------- - -- :doc:`nginx` - -You can use Nextcloud over plain http, but we strongly encourage you to use -SSL/TLS to encrypt all of your server traffic, and to protect user's logins and -data in transit. - -- Remove the server block containing the redirect -- Change **listen 443 ssl** to **listen 80;** -- Remove **ssl_certificate** and **ssl_certificate_key**. -- Remove **fastcgi_params HTTPS on;** - -Suppressing Log Messages -======================== - -If you're seeing meaningless messages in your logfile, for example `client -denied by server configuration: /var/www/data/htaccesstest.txt -`_, add this section to -your nginx configuration to suppress them: - -.. code-block:: nginx - - location = /data/htaccesstest.txt { - allow all; - log_not_found off; - access_log off; - } - -JavaScript (.js) or CSS (.css) files not served properly -======================================================== - -A common issue with custom nginx configs is that JavaScript (.js) -or CSS (.css) files are not served properly leading to a 404 (File not found) -error on those files and a broken webinterface. - -This could be caused by the: - -.. code-block:: nginx - - location ~* \.(?:css|js)$ { - -block shown above not located **below** the: - -.. code-block:: nginx - - location ~ \.php(?:$|/) { - -block. Other custom configurations like caching JavaScript (.js) -or CSS (.css) files via gzip could also cause such issues. diff --git a/admin_manual/installation/source_installation.rst b/admin_manual/installation/source_installation.rst index bda3aeb6a..09d364bf2 100644 --- a/admin_manual/installation/source_installation.rst +++ b/admin_manual/installation/source_installation.rst @@ -454,7 +454,7 @@ be set in the ``nextcloud/.user.ini`` file. Other Web Servers ----------------- -:doc:`nginx_examples` +:doc:`nginx` `Other HTTP servers (Nextcloud) diff --git a/admin_manual/issues/general_troubleshooting.rst b/admin_manual/issues/general_troubleshooting.rst index dedf2c51e..9cda03cb0 100644 --- a/admin_manual/issues/general_troubleshooting.rst +++ b/admin_manual/issues/general_troubleshooting.rst @@ -261,8 +261,8 @@ and if running in a subfolder like ``nextcloud``: For the first case the :file:`.htaccess` file shipped with Nextcloud should do this work for your when running Apache. You only need to make sure that your -Web server is using this file. When running NGINX please refer to -:doc:`../installation/nginx_examples`. +Web server is using this file. When running Nginx please refer to +:doc:`../installation/nginx. If your Nextcloud instance is installed in a subfolder called ``nextcloud`` and diff --git a/admin_manual/release_notes.rst b/admin_manual/release_notes.rst index 7e02afe8e..309ffc90a 100644 --- a/admin_manual/release_notes.rst +++ b/admin_manual/release_notes.rst @@ -15,6 +15,9 @@ Updates to Nginx configuration those lines in your Nginx config: ``add_header X-Frame-Options "SAMEORIGIN";`` See :doc:`installation/nginx` +* For improvements in serving HTTP requests the Nginx configuration now has + HTTP 2 enabled. Please update your Nginx config accordingly. See + :doc:`installation/nginx` Q & A -----