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

Add specific section for CDN and fix language and grammar #1151

Merged
merged 2 commits into from
Oct 30, 2023
Merged
Changes from all 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
27 changes: 23 additions & 4 deletions guides/hosting/infrastructure/filesystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Shopware 6 stores and processes a wide variety of files. This goes from product

Shopware 6 can be used with several cloud storage providers. It uses [Flysystem](https://flysystem.thephpleague.com/docs/) to provide a common interface between different providers as well as the local file system. This enables your shops to read and write files through a common interface.

The file system can be divided into multiple adapters. Each adapter can handle one or more of the following directories: media. sitemaps, and more. Of course, you can also use the same configuration for:
The file system can be divided into multiple adapters. Each adapter can handle one or more of the following directories: media, sitemaps, and more. Of course, you can also use the same configuration for:

* private files: invoices, delivery notes, plugin files, etc.
* public files: product pictures, media files, plugin files in general
Expand All @@ -37,7 +37,7 @@ The configuration for file storage of Shopware 6 resides in the general bundle c
To set up a non-default filesystem for your shop, you need to add the `filesystem:` map to the `shopware.yml`. Under this key, you can separately define your storage for the public, private, theme, sitemap, and asset \(bundle assets\).

::: info
You can also change only the URL of the file systems. This is useful if you want to use a different domain for your files. For example, you can use a CDN for your public files.
You can also change the URL of the file systems. This is useful if you want to use a different domain for your files. For example, you can use a CDN for your public files.
:::

```yaml
Expand All @@ -61,7 +61,7 @@ shopware:
```

If you want to regulate the uploaded file types, then you could add the keys `allowed_extensions`for the public filesystem or `private_local_download_strategy` for the private filesystem.
With the `private_local_download_strategy` key you could choose the download strategy for private files (e.g. the downloadable products):
With the `private_local_download_strategy` key you could choose the download strategy for private files (e.g., the downloadable products):

```yaml
shopware:
Expand All @@ -75,12 +75,31 @@ shopware:
private_local_download_strategy: # Name of the download strategy: php, x-sendfile or x-accel
```

Following download strategies are valid:
The following download strategies are valid:

* `php` (default): A streamed response of content type `application/octet-stream` with binary data
* `x-sendfile` (Apache only): X-Sendfile allows you to use PHP to instruct the server to send a file to a user, without having to load that file into PHP. You must have the [`mod_xsendfile`](https://github.com/nmaier/mod_xsendfile) Apache module installed.
* `x-accel` (Nginx only): X-accel allows for internal redirection to a location determined by a header returned from a backend. See the [example configuration](https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/).

## CDN configuration

If your public files are available on a CDN, you can use the following config to serve images and other assets via that CDN.

```yaml
# <project root>/config/packages/prod/shopware.yml
King-of-Babylon marked this conversation as resolved.
Show resolved Hide resolved
shopware:
filesystem:
public:
url: "YOUR_CDN_URL"
type: "local"
config:
root: "%kernel.project_dir%/public"
```

::: info
Be aware of the **prod** in the config path. CDNs are typically for production environments, but you can also set them for all environments in `config/packages/shopware.yml`.
:::

## Integrated adapter configurations

### Local
Expand Down