We regularly get asked how to host websites and/or email on Block Storage on a DirectAdmin VPS. This is indeed possible, but keep in mind that Big Storage uses HDDs and Fast Storage uses NVMe. When writing this article, we tested a website of 3.8MB (larger than most simple sites) and found no noticeable performance difference between Big Storage and, for example, the SSD of a BladeVPS.
If performance is not an issue, or if you want to offer large files (e.g. ISOs, raw media, etc.) via your websites, follow the steps in this article. We cover the following two options (and provide a use case for each):
- Hosting websites and email entirely on Block Storage using DirectAdmin
- Hosting websites and email on your VPS, with files on Block Storage
- This article is aimed at VPS with DirectAdmin and Block Storage.
- Connect your Block Storage to your VPS before starting this guide. You can use this guide for that.
Hosting websites and email on Block Storage
It is possible to host websites and email on your DirectAdmin VPS on Block Storage. Databases will remain on your VPS SSD after following these steps.
By following the steps in this section, all new accounts (i.e., admins, resellers, and users) on your DirectAdmin VPS will be created on your Block Storage. Note that this applies to all user data, including email.
- DirectAdmin 1.53 or newer is required for these steps
Step 1
Connect to your VPS via SSH or the VPS console in the TransIP control panel.
Step 2
First, create the directory where you want all user accounts to be located, for example:
sudo mkdir /mnt/bigstorage/home/
Have you mounted your Block Storage somewhere other than /mnt/bigstorage/ ? Don't forget to adjust this in the above command.
Step 3
Open the DirectAdmin configuration:
sudo nano /usr/local/directadmin/conf/directadmin.conf
Step 3
Add the following line at the bottom of the file (so you can easily find it later) and save your changes (ctrl + x > y > enter).
create_user_home_override=/mnt/bigstorage/home/
Step 4
Finally, restart DirectAdmin.
sudo systemctl restart directadmin
You are now done! All new DirectAdmin accounts will be created on your Block Storage, and the associated data will be located in the respective /mnt/bigstorage/home/username folder.
Existing accounts
Unfortunately, existing accounts cannot be migrated using the above method. A relatively simple way to transfer the data is the following method:
Step 1
Create a backup location on your Block Storage, for example:
sudo mkdir /mnt/bigstorage/temp_backup/
Step 2
Copy all the data of the respective user to the new folder (replace 'username' with the name of the account):
sudo cp -r /home/username/* /mnt/bigstorage/temp_backup
Step 3
Follow the steps earlier in this article for the procedure for new accounts.
Step 4
Delete the account in DirectAdmin and recreate it (Resellers can only be deleted by admins, users by admins or resellers).
Step 5
Now copy the data of the account back into the new folder (again via SSH, replacing 'username' with the name of the desired account) and delete the backup:
sudo cp -rf /mnt/bigstorage/temp_backup/* /mnt/bigstorage/home/username/
sudo rm -rf /mnt/bigstorage/temp_backup
The data of the existing user is now in the new folder on your Block Storage, and all changes will also take place there.
Offering files on your Block Storage for download on your website
You might want to host your website on your SSD and place files on your Block Storage but still offer them on your website. This is a useful option if you (or one of your clients) have a photography or videography business and want to offer media downloads to your clients.
The ins and outs of website development are beyond the scope of this guide, and the possibilities for offering files via Block Storage on your website are diverse. We will show one method of how to offer your files via HTML.
If you want to provide specific people with files that shouldn't be available to everyone, we recommend setting up a login system on the website in the form of a user login portal. Don't forget to secure the website with SSL and restrict access rights to the folders/files.
Alternatively, you might consider creating an FTP or SFTP account for your clients in that case. This is often safer than offering it directly on your website.
Offering files on your Block Storage via HTML
These steps assume that your website is on the SSD of your VPS and you want to offer files on your Block Storage via your website without password protection. Offering a file via a password-protected link is currently beyond the scope of this guide.
Step 1
Create a folder on your Block Storage where the files will be located. If you want to create different folders per user, you don't need to do this in this step yet.
sudo mkdir /mnt/bigstorage/files
Step 2
Go to the public_html folder of the respective domain and create a symbolic link to the folder you created in Step 1 (replace the domain name and username with your own):
sudo cd /home/transip/domains/example.com/public_html
ln -s /mnt/bigstorage/files files
Step 3
Place a file you want to share in the folder you created on your Block Storage (e.g., via FTP/SFTP). In the next step, we will use the file movie.mp4 as an example.
Step 4
If you want to create a public download link that is available to everyone, it suffices to create a link to your file in the files directory on your website. In HTML, you can do this, for example, with the following code:
<a href="/files/movie.mp4" download>Download Link</a>
Should you have any questions based on this article, please do not hesitate to contact our support department. You can reach them via the 'Contact us' button at the bottom of this page.