Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EZP-31912: [3.1] Fixed static server example and related pieces of File Management doc #1148

Merged
merged 5 commits into from
Oct 16, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions docs/guide/file_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ez_io:
adapter: default
```

The 'default' Flysystem adapter's directory is based on your site settings, and will automatically be set to `%ezpublish_legacy.root_dir%/$var_dir$/$storage_dir$` (for example: `/path/to/ezpublish_legacy/var/ezdemo_site/storage`).
The 'default' Flysystem adapter's directory is based on your site settings, and will automatically be set to `%webroot_dir%/$var_dir$/$storage_dir$` (for example: `/path/to/ezplatform/public/var/site/storage`).

#### Configure the permissions of generated files

Expand Down Expand Up @@ -137,7 +137,7 @@ For [more information about REST API see the documentation](../api/rest_api_guid

### IO URL decoration

By default, images and binary files referenced by content will be served from the same server as the application, for example `/var/ezdemo_site/storage/images/3/6/4/6/6463-1-eng-GB/kidding.png`. This is the default semantic configuration:
By default, images and binary files referenced by content will be served from the same server as the application, for example `/var/site/storage/images/3/6/4/6/6463-1-eng-GB/kidding.png`. This is the default semantic configuration:
alongosz marked this conversation as resolved.
Show resolved Hide resolved

``` yaml
ezplatform:
Expand All @@ -151,7 +151,9 @@ ezplatform:

### Using a static server for images

One common use case is to use an optimized nginx to serve images in an optimized way. The example image above could be made available as `http://static.example.com/images/3/6/4/6/6463-1-eng-GB/kidding.png` by setting up a server that uses `ezpublish/ezpublish_legacy/var/ezdemo_site/storage`. The configuration would be as follows:
One common use case is to use an optimized nginx to serve images in an optimized way. The example image
above could be made available as `http://static.example.com/var/site/storage/images/3/6/4/6/6463-1-eng-GB/kidding.png`
by setting up a separate server that maps `/path/to/ezplatform/public/var` directory. The configuration would be as follows:
alongosz marked this conversation as resolved.
Show resolved Hide resolved

``` yaml
ezplatform:
Expand All @@ -161,14 +163,19 @@ ezplatform:
url_prefix: 'http://static.example.com/$var_dir$/$storage_dir$'
```

!!! caution

For security reasons it is recommended not to map `/path/to/ezplatform/public/` as a static server
alongosz marked this conversation as resolved.
Show resolved Hide resolved
Document Root. `/var/` directory should be mapped to `/path/to/ezplatform/public/var` directly instead.
alongosz marked this conversation as resolved.
Show resolved Hide resolved

### Internals

Any `BinaryFile` returned by the public API is prefixed with the value of this setting, internally stored as `ezsettings.scope.io.url_prefix`.

#### `io.url_prefix` dynamic container setting

Default value: `$var_dir$/$storage_dir$`
Example: `/var/ezdemo_site/storage`
Example: `/var/site/storage`

Used to configure the default URL decorator service (`ezpublish.core.io.default_url_decorator`), used by all binary data handlers to generate the URI of loaded files. It is always interpreted as an absolute URI, meaning that unless it contains a scheme (http://, ftp://), it will be prepended with a '/'.

Expand Down