The information on this page describes how you can view and access various system files in your Cloud Platform environments.
You can download your database backups using the Databases page in the Cloud Platform interface, as described in Automated database backups. You can download your logs using the Logs page, as described in About Cloud Platform logging.
You can also access and transfer your files using the sftp
, scp
, rsync
, or ssh
commands. You must connect using the SSH syntax provided near the bottom of the Environment Overview page in the Cloud user interface.
File locations
You can access the file paths and directories for each of your environments at the following locations:
[site]
: Your application’s site name[env]
: The alias for the environment, typically one of the following:dev
(Development),test
(Staging), orprod
(Production)[sitedir]
: Your application’s folder in the[docroot]/sites
directory (for more information, see About Drupal multisite installations)[infrastructurename]
: The infrastructure associated with your application, which you can find on the Infrastructure page for the environment[logname]
: The log file you want to access (for a list of available log files, see About Cloud Platform logging)
Area | Path | Descriptions |
---|---|---|
Public files | /mnt/files/[site].[env]/files | Root files directory for public downloads. |
Public files (multisite) | /mnt/files/[site].[env]/sites/[sitedir]/files | Multisite files directory for public downloads for your application. |
Private files | /mnt/files/[site].[env]/files-private | Root files directory for private downloads — instructions to change the default path. |
Private files (multisite) | /mnt/files/[site].[env]/sites/[sitedir]/files-private | Multisite files directory for private downloads for your application — instructions to change the default path. |
Temporary files |
| Ephemeral data storage, per infrastructure, for temporary files generated by Drupal (for multi-server installations, see Correcting broken file uploads). |
Twig cache files | /mnt/tmp/[site][env]/php_storage/twig | Storage for all Twig cache files for all websites hosted by this environment. |
Backups | /mnt/files/[site].[env]/backups | Downloadable daily and on-demand database backups. |
Import | /mnt/files/[site].[env]/import | Files you upload for importing into your application. |
Logs | /var/log/sites/[site].[env]/logs/[infrastructure name]/[logname].log | Infrastructure log files (for more information, see About Cloud Platform logging). |
Live Development code repository | /mnt/gfs/[site].[env]/www | Code repository for your Live Development (for more information, see Using the Live Development mode). |
Modifying the private files directory
You can change the private files directory by setting the file_private_path
variable in your application’s settings.php
file. Although the directory may be set to one of the Cloud Platform default locations described in the previous table, it may also be set to /mnt/files/[site].[env]/sites/default/files-private
(where [site]
is the sitename, [env]
is the environment name, and [sitedir]
is the directory for the multisite).
If you want to use a different location for private files, save the file system form for all websites in all environments which, when processed, will create the correct directories. To set a different location, complete the following steps:
Add the following code to your website’s
settings.php
file to detect both the Acquia environment and the current Drupal multisite:Drupal version Code Drupal 7 if (isset($_ENV['AH_SITE_ENVIRONMENT'])) { $files_private_conf_path = conf_path(); $conf['file_private_path'] = '/mnt/files/' . $_ENV['AH_SITE_GROUP'] . '.' . $_ENV['AH_SITE_ENVIRONMENT'] . '/' . $files_private_conf_path . '/files-private'; } else { $conf['file_private_path'] = '{PATH}'; }
Current Drupal version if (isset($_ENV['AH_SITE_ENVIRONMENT'])) { $settings['file_private_path'] = '/mnt/files/' . $_ENV['AH_SITE_GROUP'] . '.' . $_ENV['AH_SITE_ENVIRONMENT'] . '/' . $site_path . '/files-private'; } else { $settings['file_private_path'] = '{PATH}'; }
where
{PATH}
is the path for the local infrastructure’s private files directory. The code allows you to set a non-Acquia private files location for working on a local infrastructure’s copy of the website.- Save your
settings.php
file changes. - Sign in to your Drupal website as an administrator.
- Navigate to Configuration > Media > File system (
http://[site_URL]/admin/config/media/file-system
). - Click Save.
You can find the path for your private files directory in the text area under Private file system path. Cloud Platform users can also set their private file directory to ../acquia-files/files-private
in Drupal. This setting will propagate across all their environments.
After you save the private files directory, it will persist until you delete it. Saving a private files directory creates an .htaccess
file containing the command Deny from all
, which prevents the serving of files from the private directory.
After you save the private file system path, fields in Drupal can use it. For example, you can add a file field to the Articles
content type. As you configure the file field, you can choose the file’s Upload destination by selecting either Public files or Private files. Files uploaded to this field are stored in your database’s files_managed
table with the private:
protocol, instead of the public:
protocol.
You can control access to files uploaded through a file field by clearing the Display checkbox next to the file before publishing the piece of content the file is attached to. As the file will not display, users cannot click it, nor can they navigate directly to any files in the private directory.
For a more detailed level of access to private files, you can write custom modules to interact with Drupal’s private file system.