How to use block storage for existing website without delete/moving it to the block storage? my /dev/sda1 is now full, I attach a new volume like 50GB, and it already mouted in /mnt/volume… I’m using easyengine nginx to host my website. My website is located at /var/www/example.com/htdocs, and I want to use my block storage to save my wp-content that located in /var/www/example.com/htdocs/wp-content. so It will saved in block storage… what should I do? I’ve try this Link
I try this
mkdir /mnt/volume.../wp-content
sudo chown -R www-data:www-data /mnt/volume.../wp-content
and edit /etc/nginx/sites-enabled/default and add this to the last line
location /wp-content/ {
alias /mnt/volume.../wp-content/;
}
after that, I save it, and restart nginx service, and it got error serverctl1… can you help me how to implement this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
@novaneviyantia Wordpress accesses the filesystem directly in order to save files—it doesn’t go through Nginx. So while Nginx will still ‘redirect’ requests to the Volume, Wordpress will save files in /var/www/html/wp-content.
You can use a symlink in order to have Wordpress save files on the Volume as well (make sure the paths are correct—I tried to guess based on your config):
# move any existing files to the Volume
sudo mv /var/www/html/wp-content/* /mnt/volume-sfo2-01/wp-content/*
# delete the old (now empty) directory
sudo rm -r /var/www/html/wp-content
# create a symlink to points to wp-content on the Volume
sudo ln -s /mnt/volume-sfo2-01/wp-content /var/www/html/wp-content
Because this is set up on the filesystem, you can also remove the Nginx alias and it would still work.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.