Changing the root directory of a Cyberpanel site

Hello, I want to change the root directory of a Cyberpanel site, like the root of the document below in plesk. How can I do that.

2763579880

Welcome @ermah1gunes Happy you are here

You can create the website first then change the docRoot path using vHost configuration e.g.

docRoot                   $VH_ROOT/public_html  # change here to something like $VH_ROOT/public_html/api OR $VH_ROOT/api
vhDomain                  $VH_NAME
vhAliases                 www.$VH_NAME
adminEmails               [email protected]
enableGzip                1
enableIpGeo               1

index  {
  useServer               0
  indexFiles              index.php, index.html
}

...

Thank you. There is a problem, I want to point the subdomain to another subdomain.

site.site.comsite2.site.com.

What should I do?

This cannot be done automatically on CyberP but there is a longer process that is error prone:

Before you start remove SSL certificate for site.site.com and remove any mailboxes for that subdomain

  1. Create the path /home/site1.site.com/public_html

  2. Go to https://SERVER_URL:7080/index.php#view/confMgr.php?m=vh_site.site.com&p=g

  3. Under General card click edit

  • Document root will not be created by the server automatically if it does not already exist. Please ensure that both the directory exists and it is owned by the correct user.
  1. Change the Virtual Host Name with site1.site.com from Step 1

This will change the virtual host file and you will require you to add entries for:

  • On Base tab change the Document Root with path from Step 1
  • On General tab fill in General and Index Files cards
  1. Confirm there is NO paired SSL private key and SSL certificate for SSL listener
  • By now you see “Configuration has been modified. To apply changes, please perform a graceful restart.” message. Performa graceful restart

6.Reboot the server and Go to your CyberPanel admin panel to check if everything is set.

  • Go to https://SERVER_URL:8090/phpmyadmin/index.php?route=/sql&db=cyberpanel&table=websiteFunctions_websites&pos=0
  • On that table websiteFunctions_websites look for the line site.site.com and change to site1.site.com
  • Go back to list of websites - viola!
  1. Issue SSL etc

Reference:

Go to vhost configuration and change after adding changes restart lsws as well