CHANGING DOCUMENT ROOT IN VESTACP WEBSITES
September 24, 2018 / by Marco / Categories : Business
The best way I have found to change the Document Root for specific websites in VestaCP is to create a new Web Template for each domain. I previously edited the document root path in the config file for each for each domain but when NGINX or the server restarted it would revert back to the default: root /home/admin/web/domain.com/public_html/;
I needed the root path to be this:
root /home/admin/web/domain.com/public_html/public;
So here are the instructions on how to fix this permanently (I’m using a Virtual Private Server from Chicago VPS rather than a shared server). My VPS setup uses VestaCP with php-fpm and NGINX:
- Login to your VPS
- Go to the web templates locate in /usr/local/vesta/data/templates/web/nginx/php-fpm/

If you’re using apache then the path is /usr/local/vesta/data/templates/web/httpd and you need to edit the default.tpl and default.stpl files
- Create two new templates with your domain name in the filename. E.g copy the two wordpress2 templates as follows:
- cp wordpress2.stpl wordpress2-domainname.stpl
- cp wordpress2.tpl wordpress2-domainname.tpl
- NOTE: stpl is the template used for SSL. So if you intend to use SSL make sure you also copy the stpl file.
- Edit each file and modify the root path
- vi wordpress2-domainname.stpl
- Edit the root path and then save the file

- In this particular case the default %docroot% variable is set to /home/admin/web/domainname/public_html/ (where domainname is the web domain name)
- Do the same to vi wordpress2-domainname.tpl
- Login to your VestaCP dashboard and click on Web – your domain name. In the Web Template (NGINX) select the new template you created:

- That’s it, the document root for that particular domain will be permanently set to the folder you specified. Hope this helped and if it did please share it or leave me a comment.
OTHER ARTICLES YOU MAY LIKE
STOP NOISY CALLS: THE ANDROID SETTING YOU SHOULD SWITCH ON TODAY
Phone calls still matter. Whether you’re speaking to a client, checking in with family, or handling something urgent on the move, clarity can make or break the conversation. If you’ve ever found yourself apologising for the construction noise behind you, the wind across your microphone, or the café chatter muddling your words, there’s an Android […]
read more
FILMORA 15 – WHAT’S NEW? AI EXTEND, DYNAMIC CAPTIONS, TRUE TIMELINE EDITING + INSTALL GUIDE
There is a particular thrill to installing a major new release of your everyday editor, especially when your workflow is comfortable and productive in the current version. That feeling is right at the heart of the move from Filmora 14 to Filmora 15. This upgrade promises fresh creative features, faster handling of complex projects, and […]
read more
