Subdomain: Place holder page.

kevinwalter

Verified User
Joined
Jun 1, 2011
Messages
47
Hey,

I've changed my default subdomain dir to: /home/user/domains/domain/subdomains/SUB
Instead of the public_html map.

It's working but the placeholder page isn't working. How can I fix this?

And also if I create a new user the map subdomains isn't there by default. How can I add it?

I could not find this on the forum/google.

Greetz,
Kevin
 
what do you mean for "placeholder page not working"?

have you made default templates customization?

Have you used subdomain_create_post.sh and subdomain_destroy_post.sh for file/folder/permission customization?

Regards
 
what do you mean for "placeholder page not working"?

have you made default templates customization?

Have you used subdomain_create_post.sh and subdomain_destroy_post.sh for file/folder/permission customization?

Regards

If I use that (the one from the forum) it won't create subdomains anymore.
I get then a "Server could not find" error.

I mean this place holderpage: http://test.kw-sys.nl/
Its doing this if I create a subdomain: http://doh.kw-sys.nl/
 
Cause DA will put those file in the original path, you must use subdomain_create_post.sh to copy/move placeholder file to the correct path.

Regarding "If I use that (the one from the forum) it won't create subdomains anymore." thats strange, maybe is just a missconfiguration, ive tryed that time ago and was working, just had to fix some part of the script for dont remove existing directory (ex. /forum was moved to subdomain on creation and that was something to dont do in case a customer wanted to make forum.domain and domain/forum keeping the orignal).

Regards
 
Cause DA will put those file in the original path, you must use subdomain_create_post.sh to copy/move placeholder file to the correct path.

Regarding "If I use that (the one from the forum) it won't create subdomains anymore." thats strange, maybe is just a missconfiguration, ive tryed that time ago and was working, just had to fix some part of the script for dont remove existing directory (ex. /forum was moved to subdomain on creation and that was something to dont do in case a customer wanted to make forum.domain and domain/forum keeping the orignal).

Regards


Something like this?

Code:
#!/bin/sh
 
#Create default index page for the subdomain
TEMPLATE_DIR=/usr/local/directadmin/data/templates/custom
TEMPLATE_FILE=$TEMPLATE_DIR/subdomain_placeholder.html
DEST_DIR=/home/$username/domains/$domain/subdomains/$subdomain
DEST_FILE=$DEST_DIR/index.html
INDEX=/home/$username/domains/$domain/public_html/$subdomain/index.html
INDEXMA=/home/$username/domains/$domain/public_html/$subdomain/

rm -f $INDEX
rm -f $INDEXMA
cp $TEMPLATE_FILE $DEST_FILE
chmod 644 $DEST_FILE
chown $username:$username $DEST_FILE
 
STR="perl -pi -e 's/\|SUBDOMAIN\|/$subdomain.$domain/' $DEST_FILE"
eval $STR;
 
exit 0;
EDIT:
This is what happend if I put that script in my server: http://test.tweakenl.info/ .
 
Last edited:
Last edited:
did you:

chown diradmin:diradmin scriptname
chmod 700 scriptname

and put scripts in /usr/local/directadmin/scripts/custom/ directory?
 
did you:

chown diradmin:diradmin scriptname
chmod 700 scriptname

and put scripts in /usr/local/directadmin/scripts/custom/ directory?

It's in there:

Code:
-bash-3.2# cd /usr/local/directadmin/scripts/custom/
-bash-3.2# dir
README  subdomain_create_post.sh
-bash-3.2#

I did not chmod it to 700 but to 644. I'm now testing it out.

Edit: No it's not working :(
 
700 is ok as permission, i use that way.

By the way, try to add mkdir $DEST_DIR

before copy, maybe doesnt exist?

Regards



Yep, thats right. The subdomains dir doesn't exist. I'll try it.


Ahh its working. :) For the one's this is the solution:

Code:
NOT UP TO DATE.. CHECK BELOW
#!/bin/sh

#Create default index page for the subdomain
TEMPLATE_DIR=/usr/local/directadmin/data/templates/custom
TEMPLATE_FILE=$TEMPLATE_DIR/subdomain_placeholder.html
DEST_DIR=/home/$username/domains/$domain/subdomains/$subdomain
DEST_FILE=$DEST_DIR/index.html
INDEXMA=/home/$username/domains/$domain/public_html/$subdomain/

mkdir $DEST_DIR
mkdir $DEST_DIR/cgi-bin
rm -rf $INDEXMA
cp $TEMPLATE_FILE $DEST_FILE
chmod 777 $DEST_FILE
chown $username:$username $DEST_FILE

STR="perl -pi -e 's/\|SUBDOMAIN\|/$subdomain.$domain/' $DEST_FILE"
eval $STR;

exit 0;

It's working now. But he creates still a map in public_html... with cgi-bin in it. EDIT: fixed by adding -R to the rm command.



EDIT 2:

Using the above script the permissions are still not ok.

Code:
Commando:	DELE index.html
Antwoord:	550 index.html: Permission denied
Commando:	RMD cgi-bin
Antwoord:	550 cgi-bin: Permission denied

Again fixed by using this script:

Code:
ALSO NOT UP TO DATE. CHECK AGAIN BELOW

#!/bin/sh

#Create default index page for the subdomain
TEMPLATE_DIR=/usr/local/directadmin/data/templates/custom
TEMPLATE_FILE=$TEMPLATE_DIR/subdomain_placeholder.html
DEST_DIR=/home/$username/domains/$domain/subdomains/$subdomain
DEST_FILE=$DEST_DIR/index.html
INDEXMA=/home/$username/domains/$domain/public_html/$subdomain/

mkdir $DEST_DIR
mkdir $DEST_DIR/cgi-bin
rm -rf $INDEXMA
cp $TEMPLATE_FILE $DEST_FILE
chmod 777 $DEST_FILE
chown -R $username.$username $DEST_DIR


STR="perl -pi -e 's/\|SUBDOMAIN\|/$subdomain.$domain/' $DEST_FILE"
eval $STR;

exit 0;


Some bugfixes:
Code:
#!/bin/sh

#Create default index page for the subdomain
TEMPLATE_DIR=/usr/local/directadmin/data/templates/custom
TEMPLATE_FILE=$TEMPLATE_DIR/subdomain_placeholder.html
DEST_DIR=/home/$username/domains/$domain/subdomains/$subdomain
DEST_FILE=$DEST_DIR/index.html
INDEXMA=/home/$username/domains/$domain/public_html/$subdomain/
SUBDIR=/home/$username/domains/$domain/subdomains

mkdir $SUBDIR
mkdir $DEST_DIR
mkdir $DEST_DIR/cgi-bin
rm -rf $INDEXMA
cp $TEMPLATE_FILE $DEST_FILE
chmod 777 $DEST_FILE
chown -R $username.$username $SUBDIR


STR="perl -pi -e 's/\|SUBDOMAIN\|/$subdomain.$domain/' $DEST_FILE"
eval $STR;

exit 0;
 
Last edited:
Back
Top