Created Setting up a private files folder for Drupal (markdown)
parent
600193cd7c
commit
17e7d8c16d
44
Setting-up-a-private-files-folder-for-Drupal.md
Normal file
44
Setting-up-a-private-files-folder-for-Drupal.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
In this guide we will create a Private files folder for Drupal.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
* A [[Drupal setup|Setting up Drupal 7]]
|
||||||
|
|
||||||
|
## Private folder creation
|
||||||
|
|
||||||
|
Create a folder with *www-data* ownership:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo mkdir /srv/webadmin/cms/sites/default/private
|
||||||
|
$ sudo chown www-data:webadmin /srv/webadmin/cms/sites/default/private
|
||||||
|
```
|
||||||
|
|
||||||
|
Set the new private folder in Drupal settings:
|
||||||
|
|
||||||
|
`Administration -> Configuration -> Media`
|
||||||
|
|
||||||
|
Then use these setting:
|
||||||
|
|
||||||
|
* Private file system path: **sites/default/private**
|
||||||
|
* Default download method: **Private local files served by Drupal**
|
||||||
|
|
||||||
|
## Setup Nginx
|
||||||
|
|
||||||
|
We need to add this rule under the cms virtualhost configuration (/etc/nginx/sites-enabled/cms) under the **server** section:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Setup private folder
|
||||||
|
location ^~ /sites/default/private {
|
||||||
|
internal;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Reload *Nginx*:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo systemctl reload nginx
|
||||||
|
```
|
||||||
|
|
||||||
|
References
|
||||||
|
----------
|
||||||
|
* https://www.drupal.org/node/2709571
|
Loading…
Reference in a new issue