From 67cb3acd6aef8869fab5e4330e4be412c5d53ea1 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Fri, 4 Nov 2022 12:10:21 +0000 Subject: [PATCH] [FIX] deploy.rst: nginx config for static files In case of a source install the various places where static files can be found are spread on the filesystem. The previous configuration sample used custom internal locations but it turns out that it is only possible to `try_files` on filesystem paths and on "named location (@ ones)". This commit fixes the configuration sample so that it works for the given situation where community and enterprise has been cloned from git. task-3049538 closes odoo/documentation#2902 Signed-off-by: Julien Castiaux --- content/administration/install/deploy.rst | 38 +++++++++-------------- 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/content/administration/install/deploy.rst b/content/administration/install/deploy.rst index 17838a9d5..5a9c85ed3 100644 --- a/content/administration/install/deploy.rst +++ b/content/administration/install/deploy.rst @@ -415,9 +415,11 @@ by intercepting all requests to :samp:`/{MODULE}/static/{FILE}`, and looking up (and file) in the various addons paths. .. example:: - Say Odoo has been installed via the **debian packages** for Community and Enterprise, the addons - paths is :file:`/usr/lib/python3/dist-packages/odoo/addons`. Using the above NGINX (https) - configuration, the following location block should be added to serve static files via NGINX. + Say Odoo has been installed via the **debian packages** for Community and Enterprise and the + :option:`--addons-path ` is ``'/usr/lib/python3/dist-packages/odoo/addons'``. + + Using the above NGINX (https) configuration, the following location block should be added to + serve static files via NGINX. .. code-block:: nginx @@ -433,11 +435,13 @@ by intercepting all requests to :samp:`/{MODULE}/static/{FILE}`, and looking up } .. example:: - Say Odoo has been installed via the **source**, and the two git repositories for Community and - Enterprise has been cloned in :file:`/opt/odoo` and :file:`/opt/odoo-enterprise` respectively. - The addons paths is ``/opt/odoo/odoo,/opt/odoo/addons,/opt/odoo-enterprise``. Using the above - NGINX (https) configuragion, the following location block should be added to serve static files - via NGINX. + Say Odoo has been installed via the **source**. The two git repositories for Community and + Enterprise have been cloned in :file:`/opt/odoo/community` and :file:`/opt/odoo/enterprise` + respectively and the :option:`--addons-path ` is + ``'/opt/odoo/community/odoo/addons,/opt/community/addons,/opt/odoo/enterprise'``. + + Using the above NGINX (https) configuration, the following location block should be added to + serve static files via NGINX. .. code-block:: nginx @@ -447,24 +451,10 @@ by intercepting all requests to :samp:`/{MODULE}/static/{FILE}`, and looking up # Serve static files right away location ~ ^/[^/]+/static/.+$ { - try_files /static-base$uri /static-addons$uri /static-enterprise$uri @odoo$uri; + root /opt/odoo; + try_files /community/odoo/addons$uri /community/addons$uri /enterprise$uri @odoo; expires 24h; } - - location /static-base { - internal; - alias /opt/odoo/odoo/addons; - } - - location /static-addons { - internal; - alias /opt/odoo/addons; - } - - location /static-enterprise { - internal; - alias /opt/odoo-enterprise; - } .. warning:: The actual NGINX configuration you need is highly dependent on your own installation. The two