Changing the Web Root

Last updated: November 8th 2022

Webdock servers are configured so that the default webroot is /var/www/html. As a rule of thumb this is where you should place your web application files.

However, if you need to change your webroot you can do so in Webdock. Click on the small pencil icon next to the Web root on the main server information screen. 

You can choose to have Webdock update your webserver and Let's Encrypt configuration so that the webserver resolves your new root directory correctly, and Let's Encrypt can continue renewing any existing certificates.

The directory you specify must already exist. The change web root functionality does not create the directory for you.

The directory you specify should ideally be owned by www-data:www-data

When updating webserver configuration the following happens:

  1. We set the new path in your webserver configuration files. Webdock will update any files found in /etc/nginx/sites-available/* (for Nginx) or /etc/apache2/sites-available/* (for Apache). Webdock will make the replacement in all config files found, so if you have created custom files, it may be better you do this manually.
     
  2. We issue a reload command - the webserver should start reading files from the new Web Root immediately.
     
  3. We symlink in the default phpMyAdmin installation to the new web root location

When updating Let's Encrypt configuration the following happens:

  1. We update any configuration files found in /etc/letsencrypt/renewal/* and set the new web root for all domains listed in these config files. If you have a custom setup, it may be better you do this manually.

You should always run the Test Certbot Renewal script (found in the Script Library) on your server to make sure renewals are working correctly after performing this operation.

Once completed, in addition to the potential server configuration changes above, all Webdock operations that reference the web root (such as Wordpress install) will use the new Web Root.

If you have any questions or problems with this functionality, please be in touch with Webdock support

We use cookies. Please see our Privacy Policy.