- Views: 792
- Replies: 10
The External Storage Connection feature allows you to store XenForo 2 attachments on an external PHP hosting server automatically (the PHP server only needs to support basic functions: curl_version, openssl_encrypt, openssl_decrypt, md5_file, fread, fopen. No SQL required).
Benefits of this: Reduce the load on your main server, you can buy cheap hosting or build your own server at home to act as a secondary server to store your attachments.
Automatic and Manual Processing:
- Files can be automatically processed every 15 minutes by cron job (External Storage Cron Job).
- You can run it manually via: Tools -> Rebuild caches -> [XenVn] Rebuild Data -> Move attachments to External Storage / Restore attachments to Internal Storage (It may take a long time if there are many files)
- Or move each file you want at: Contents -> Attachments.
You can see the list of attachments on External Storage at: Contents -> Attachments -> Enable Filter Storage
Forum, Resource, Direct Message and Profile Post Support
Apply external storage to specific forums, resource categories, direct messages and profile post.
Flexible Filtering:
- Filter attachments by file extensions.
- Apply minimum and maximum file size thresholds.
Requires a simple storage.php endpoint on your external PHP server to handle the connection. The PHP server only needs to support basic functions: curl_version, openssl_encrypt, openssl_decrypt, md5_file, fread, fopen. No SQL connection required.
Chunked Attachment Range support
This feature allows attachments to be downloaded in chunks using HTTP Range requests, letting users resume interrupted downloads and partially download large files without starting over.
Secure, Safe and Reliable:
- Synchronize attachment folder structure between Xenforo server and External Storage server.
- The system checks file integrity when moving between 2 servers.
- Easily Move/Restore Attachments by Automatic or Manual.
When an attachment is stored on External Storage, it will be ignored by the Rebuild Cache tools related to the file such as: Optimize attachments, Rebuild attachment thumbnails,.. and [XenVn] Rebuild Data tools.
The External Storage feature can store both images and display them directly on your forum normally. But do not abuse it when not necessary.
Activation and Usage Instructions:
1. Go to XenVn Setting -> Storage Tab
2. Enable the option: Enable External Storage Connection
3. Download the file "storage.php" in the description or by the following link:
admin.php?xv/external-storage&download=1
4. Open the file and set 2 parameters: CONNECTION_KEY_CODE, FOLDER
+ CONNECTION_KEY_CODE: Secret code to establish a connection between 2 servers, you choose.
+ FOLDER: Folder to store attachments (not public).
5. External Storage Cron Job: Enable automatic Move/Restore of attachments every 15 minutes via Cron Job.
6. Connection Key Code: Set the same security code you set for CONNECTION_KEY_CODE
7. External Storage URL: The path to the storage.php file on your external storage server, which can be a domain name or an ip address.
For example:
https://your-storage.com/folder/storage.php
8. Optional settings: Apply Forum / Resource, Apply Direct Message, Apply Profile Post, Apply Attachment Extensions, Apply Minimum Attachment Size, Apply Maximum Attachment Size.
9. Once the setup is complete, click the Save button.
10. Click the "click here to check the connection" link at the top to check and establish a connection to the external data storage server.
Or this link: admin.php?xv/external-storage
11. If the message "Setup complete" appears, everything is ready and you can use it.
12. Otherwise, if error messages appear, you need to follow the message instructions to complete the setup process.
Stop Using External Storage Connection:
To stop using the external storage server and move all files back to your Xenforo server, follow these steps:
1. In the External Storage Cron Job section, select Disable or Restore attachments to Internal Storage.
2. Go to Tools -> Rebuild caches -> [XenVn] Rebuild Data -> Select: Restore attachments to Internal Storage -> Click Run and wait.
3. The files from the external storage server will be moved to your Xenforo server.
4. The moving process may take a long time, depending on the number of files on the external storage server.
Or manual way: Copy all folders and files in the storage folder on the external storage server (FOLDER) and overwrite them into the data / internal_data folder on the Xenforo server. (Their structure is the same).
5. Finally, turn off the Enable External Storage Connection function.
If you don't need to move quickly, set up Cron Restore attachments to Internal Storage, and wait a few days, the files will be gradually moved back to your main server.


Last edited: