[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#2945

X-original-commit: 67cb3acd6a
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Julien Castiaux 2022-11-04 12:10:21 +00:00
parent b208529745
commit 31aacc1791

View File

@ -415,9 +415,11 @@ by intercepting all requests to :samp:`/{MODULE}/static/{FILE}`, and looking up
(and file) in the various addons paths. (and file) in the various addons paths.
.. example:: .. example::
Say Odoo has been installed via the **debian packages** for Community and Enterprise, the addons Say Odoo has been installed via the **debian packages** for Community and Enterprise and the
paths is :file:`/usr/lib/python3/dist-packages/odoo/addons`. Using the above NGINX (https) :option:`--addons-path <odoo-bin --addons-path>` is ``'/usr/lib/python3/dist-packages/odoo/addons'``.
configuration, the following location block should be added to serve static files via NGINX.
Using the above NGINX (https) configuration, the following location block should be added to
serve static files via NGINX.
.. code-block:: nginx .. code-block:: nginx
@ -433,11 +435,13 @@ by intercepting all requests to :samp:`/{MODULE}/static/{FILE}`, and looking up
} }
.. example:: .. example::
Say Odoo has been installed via the **source**, and the two git repositories for Community and Say Odoo has been installed via the **source**. The two git repositories for Community and
Enterprise has been cloned in :file:`/opt/odoo` and :file:`/opt/odoo-enterprise` respectively. Enterprise have been cloned in :file:`/opt/odoo/community` and :file:`/opt/odoo/enterprise`
The addons paths is ``/opt/odoo/odoo,/opt/odoo/addons,/opt/odoo-enterprise``. Using the above respectively and the :option:`--addons-path <odoo-bin --addons-path>` is
NGINX (https) configuragion, the following location block should be added to serve static files ``'/opt/odoo/community/odoo/addons,/opt/community/addons,/opt/odoo/enterprise'``.
via NGINX.
Using the above NGINX (https) configuration, the following location block should be added to
serve static files via NGINX.
.. code-block:: 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 # Serve static files right away
location ~ ^/[^/]+/static/.+$ { 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; 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:: .. warning::
The actual NGINX configuration you need is highly dependent on your own installation. The two The actual NGINX configuration you need is highly dependent on your own installation. The two