From 17e7d8c16d9714a73937159744e2364ca9c1869a Mon Sep 17 00:00:00 2001 From: Theodotos Andreou Date: Sun, 14 Jan 2018 15:20:36 +0200 Subject: [PATCH] Created Setting up a private files folder for Drupal (markdown) --- ...ng-up-a-private-files-folder-for-Drupal.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Setting-up-a-private-files-folder-for-Drupal.md diff --git a/Setting-up-a-private-files-folder-for-Drupal.md b/Setting-up-a-private-files-folder-for-Drupal.md new file mode 100644 index 0000000..8bc7f9b --- /dev/null +++ b/Setting-up-a-private-files-folder-for-Drupal.md @@ -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 \ No newline at end of file