Note

You are viewing the documentation for an older release of Interworx (6.x). To see documentation for the current generally available release of Interworx, click here: 7.13.

How To: Customize the Apache DocumentRoot

The Apache DocumentRoot can be changed via an Apache vhost include.

Note

While the vhost include, itself, will persist if the domain is restored or imported from a backup, the symlink that is required for Let’s Encrypt and other domain verification tools will not.

If the domain is restored from a backup or imported to a new server, the symlink will have to be recreated. Skip to step 6 for instructions on how to create the required symlink.

To Update a Single Domain

  1. Log in to the server at the CLI as root, either via SSH or from the terminal

  2. Make sure the desired DocumentRoot directory has the correct permissions. The directory should be both user and group owned as the unixuser, with 2711 permissions

    chown {unixuser}:{unixuser} /home/{unixuser}/{/path/to/docroot}/
    chmod 2711 /home/{unixuser}/{/path/to/docroot}/
    
  3. Use the following command to create a new file named doc_root.conf in the domain’s /home/{unixuser}/var/{domain}/apache/ directory, and add the path to the desired DocumentRoot to that file:

    echo DocumentRoot "/home/{unixuser}/{/path/to/docroot}/" > /home/{unixuser}/var/{domain}/apache/doc_root.conf
    
  4. Make sure the file has the correct permissions. It should be user and group owned as the unixuser

    chown {unixuser}:{unixuser} /home/{unixuser}/var/{domain}/apache/doc_root.conf
    
  5. Reload Apache

    systemctl reload httpd
    
  6. Backup the domain’s /home/{user}/{domain}/html folder

    mv /home/{user}/{domain}/html/ /home/{user}/{domain}/html.bak
    
  7. Create a symlink from the default DocumentRoot location to the new, desired DocumentRoot directory

    ln -s /home/$user/$path_to_docroot /home/$user/$domain/html
    
  8. Make sure the symlink has the correct permissions. It should be user and group owned as the unixuser

    chown -h {unixuser}:{unixuser} /home/{unixuser}/{domain}/html