auto change Use a symbolic link from private_html to public_html - allows for same data in http and https directadmin

vpscanban

Verified User
Joined
Feb 9, 2022
Messages
39
Hello.

On DirectAdmin there is a command to set all existing domains to

Use a symbolic link from private_html to public_html - allows for same data in http and https directadmin

Are not. Please assist me
 

Attachments

  • CleanShot 2024-03-09 at 08.17.08.png
    CleanShot 2024-03-09 at 08.17.08.png
    642.4 KB · Views: 164
  • CleanShot 2024-03-09 at 08.17.57.png
    CleanShot 2024-03-09 at 08.17.57.png
    42.2 KB · Views: 115
My client asexually deleted with command. rm -rf /home/user/domain/*

So I brought the directory data back in. However, if you do not symlink, you will get a 404 error. When you symlink, the website will work again. The problem I'm having is that having to manually symlink for each domain is very time-consuming. I have more than 300 domains, so I need a DirectAdmin script or command to automatically transfer symlinks.
That's only the logfile, you can ignore that. It's working fine.
Or why do you think it's not working? Did you try it?
 
However, if you do not symlink, you will get a 404 error.
That is odd. Do you by any chance use an old Directadmin version? Because on newer versions there is no private_html anymore.
The only existing symlink is in the /hom/user directory and is like below:
public_html -> ./domains/domain.com/public_html

It was already removed in 1.649.
so in new installs you won't find it anymore anyway.

So if you don't symlink the private_html and get a 404, then it looks like youre using an older version of DA.

If you really require to do this for all domains in case of an older version or other reason, you can use the script from the docs or part of it.
 
haha true....indeed only for users with a private_html folder it is still there. And indeed in the enhanced skin it is still there. Which sometimes is very helpfull :D
 
I love the Enhanced skin. :) Still almost only work with that one.

I had removed my post in between, just before your answered. Seems there is also no way back in 1.650.
And allows only migrating to symlink mode. It is not possible to migrate back.
So probably once migrated to symlink, it's not possible to use seperate folders anymore.

I hope at some time they will remove that stupid symlink too and only public_html is there.
 
@Richard G
They still can remove symlink "private_html" and manual create folder for separate website data between http and https
 
@Richard G

1711897514704.png


see this, you can remove symlink, and manual create folder, set permission 0755

In the past directadmin have automatic function swap back with include full copy data from "public_html" to "private_html" folder.

In now, user must do it by themself.
 
In now, user must do it by themself.
Yes that was known to me. I just don't understand the meaning of the sentence in the changelog of 1.650.

In this version same option is introduced but only available for domains which are still using the private_html directory mode. And allows only migrating to symlink mode. It is not possible to migrate back.
So what do they mean with the "not possible to migrate back". I don't understand that part as the user still can do it by themselves.
 
@Richard G

It option for easy migrate between 2 mode ( directory and symlinks ). It can't use this option to switch back. In the past, this option can switch between 2 mode.

Since directadmin got report files corrupted after use these option, Switch back not possible by this option.
 
@jamgames2 Thank you very much. Now I understand. But the switch option is only taken away from Evo skin then as it's still present in Enhanced.
But it's clear to me now.

@vpscanban are you still looking for a script for fixing multiple domains? I don't know any scripting but maybe I can find something which you could use after some adjustments.
 
I have more than 300 domains, so I need a DirectAdmin script or command to automatically transfer symlinks.
So you have 300 domains that needs to be tansferred? Or are they already on your server?

If they already on the server you can do this.
Create 1 domain with correct symlink. Create destination.txt with all home folders. Copy symlink with -aP to alle destinations.
You should test first but i think something like this:

This will create a file with all directory's so folders with symlinks called private html will not be in it.
Code:
#directory's you need to copy to and output to txt file
find /home/ -type d -name private_html > destinations.txt

create simple bash file like below
Warning this wil REMOVE the private_html directory.
This script uses full path of cp to skip confirmation. Also change USER and EXAMPLE.TLD to user and domain to your own user and domaindir off course

Call it for example copysymlink.sh so create file and paste this:

Code:
#!/bin/bash
for i in $(cat destinations.txt)
do
  echo "$i"
  rm -rf "$i"
  /usr/bin/cp -aP /home/USER/domains/EXAMPLE.TLD/private_html "$i"
done

chmod it to 755: chmod 755 copysymlink.sh
run it: ./copysymlink.sh

And then do a:
Code:
/usr/local/directadmin/scripts/set_permissions.sh domaindirs

done
 
Back
Top