<input type="hidden" id="_wpnonce" name="_wpnonce" value="0e2dca5b10" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/26569" /><input type="hidden" id="_wpnonce" name="_wpnonce" value="0e2dca5b10" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/26569" />{"id":26569,"date":"2018-09-24T14:51:09","date_gmt":"2018-09-24T04:51:09","guid":{"rendered":"https:\/\/www.businesslegions.com\/blog\/?p=26569"},"modified":"2018-09-26T12:48:12","modified_gmt":"2018-09-26T02:48:12","slug":"changing-document-root-in-vestacp-websites","status":"publish","type":"post","link":"https:\/\/www.businesslegions.com\/blog\/2018\/09\/24\/changing-document-root-in-vestacp-websites\/","title":{"rendered":"CHANGING DOCUMENT ROOT IN VESTACP WEBSITES"},"content":{"rendered":"<!--CusAds0--><p>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\u00a0\u00a0\u00a0\u00a0\/home\/admin\/web\/domain.com\/public_html\/;<\/p>\n<p>I needed the root path to be this:<\/p>\n<p>root\u00a0\u00a0\u00a0\u00a0\/home\/admin\/web\/domain.com\/public_html\/public;<\/p>\n<p>So here are the instructions on how to fix this permanently (I&#8217;m using a <a href=\"https:\/\/billing.chicagovps.net\/aff.php?aff=905\" target=\"_blank\" rel=\"nofollow noopener\">Virtual Private Server <\/a>from <a href=\"https:\/\/billing.chicagovps.net\/aff.php?aff=905\" target=\"_blank\" rel=\"nofollow noopener\">Chicago VPS<\/a> rather than a shared server). My VPS setup uses VestaCP with php-fpm and NGINX:<\/p>\n<ul>\n<li>Login to your VPS<\/li>\n<li>Go to the web templates locate in \/usr\/local\/vesta\/data\/templates\/web\/nginx\/php-fpm\/<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-26570\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root.png?strip=all\" alt=\"Business Legions - Document Root\" width=\"617\" height=\"206\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root.png?strip=all 617w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-300x100.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-178x59.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root.png?strip=all&amp;w=123 123w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root.png?strip=all&amp;w=246 246w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root.png?strip=all&amp;w=370 370w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root.png?strip=all&amp;w=493 493w\" sizes=\"(max-width: 617px) 100vw, 617px\" \/><\/p>\n<p><em><strong>If you&#8217;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<\/strong><\/em><\/p><!--CusAds0-->\n<ul>\n<li>Create two new templates with your domain name in the filename. E.g copy the two wordpress2 templates as follows:<\/li>\n<li>cp wordpress2.stpl wordpress2-domainname.stpl<\/li>\n<li>cp wordpress2.tpl wordpress2-domainname.tpl<\/li>\n<li><em>NOTE: stpl is the template used for SSL. So if you intend to use SSL make sure you also copy the stpl file.<\/em><\/li>\n<li><em>Edit each file and modify the root path<\/em><\/li>\n<li><em>vi <\/em>wordpress2-domainname.stpl<\/li>\n<li>Edit the root path and then save the file<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-26572\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path.png?strip=all\" alt=\"Business Legions - Document Root Edit Path\" width=\"587\" height=\"210\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path.png?strip=all 587w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path-300x107.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path-178x64.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path.png?strip=all&amp;w=117 117w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path.png?strip=all&amp;w=234 234w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path.png?strip=all&amp;w=352 352w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Path.png?strip=all&amp;w=469 469w\" sizes=\"(max-width: 587px) 100vw, 587px\" \/><\/p>\n<ul>\n<li>In this particular case the default %docroot% variable is set to \/home\/admin\/web\/domainname\/public_html\/ (where domainname is the web domain name)<\/li>\n<li>Do the same to <em>vi <\/em>wordpress2-domainname.tpl<\/li>\n<li>Login to your VestaCP dashboard and click on Web &#8211; your domain name. In the Web Template (NGINX) select the new template you created:<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-26573\" src=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Web-Template.png?strip=all\" alt=\"Business Legions - Document Root Edit Web Template\" width=\"533\" height=\"259\" srcset=\"https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Web-Template.png?strip=all 533w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Web-Template-300x146.png?strip=all 300w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Web-Template-178x86.png?strip=all 178w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Web-Template.png?strip=all&amp;w=106 106w, https:\/\/cdn.businesslegions.com\/blog\/wp-content\/uploads\/2018\/09\/Business-Legions-Document-Root-Edit-Web-Template.png?strip=all&amp;w=426 426w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/p>\n<ul>\n<li>That&#8217;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.<\/li>\n<\/ul>\n<div class=\"lt-box\" style=\"border:1px solid #1d6a9e\"><div class=\"lt-box-title\" style=\"background-color:#2485C6;border-top:1px solid #a7cee8;text-shadow:1px 1px 0 #0b283b\">DO YOU LIKE WHAT YOU'VE READ?<\/div><div class=\"lt-box-content\">Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!\r\n\r\n<p><div class=\"tnp tnp-subscription \">\n<form method=\"post\" action=\"https:\/\/www.businesslegions.com\/blog\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<div class=\"tnp-field tnp-field-firstname\"><label for=\"tnp-1\">Name<\/label>\n<input class=\"tnp-name\" type=\"text\" name=\"nn\" id=\"tnp-1\" value=\"\" placeholder=\"\"><\/div>\n<div class=\"tnp-field tnp-field-email\"><label for=\"tnp-2\">Email<\/label>\n<input class=\"tnp-email\" type=\"email\" name=\"ne\" id=\"tnp-2\" value=\"\" placeholder=\"\" required><\/div>\n<div class=\"tnp-field tnp-field-button\" style=\"text-align: left\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<\/div>\n<\/form>\n<\/div>\n<\/p>\r\n\r\n<\/div><\/div><!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":26574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3133,6386,1968,1625],"class_list":["post-26569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business","tag-business","tag-document-root","tag-vestacp","tag-websites-2"],"_links":{"self":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/26569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/comments?post=26569"}],"version-history":[{"count":2,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/26569\/revisions"}],"predecessor-version":[{"id":26571,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/26569\/revisions\/26571"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media\/26574"}],"wp:attachment":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media?parent=26569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/categories?post=26569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/tags?post=26569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}