HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Creating extra folders for new websites. (http://www.howtoforge.com/forums/showthread.php?t=37567)

Gleno0h 20th July 2009 04:10

Creating extra folders for new websites.
 
Hey!

Well after installing ispconfig3 i was kinda bussy with making a script for new users to auto install joomla, phpbb3 etc.

Now my question is, how can i add a extra folder to the new sites that i create?

It now makes the folders:
cgi-bin
ssl
tmp
web
-error
-stats

but what i want is
cgi-bin
ssl
tmp
web
-error
-stats
-extra

How can i make it like that for every new website?

Thanks!

dzudzu 20th July 2009 05:21

This is just from my own research so wait for confirmation but till then u can toy around with this:

in /usr/local/ispconfig/server/plugins-enabled

file: apache2_plugin.inc.php

there is this code

// make temp direcory writable for the apache user and the website user
exec("chmod 777 ".escapeshellcmd($data["new"]["document_root"]."/tmp"));

i belive u can add another line below with appropriate chmod like 755 so it gets created

as example u asked i guess it would be something like:
exec("chmod 755 ".escapeshellcmd($data["new"]["document_root"]."/extra"));

thou note that index file is in web folder so i guess u maybe want to make /web/extra

just few of my thoughts

Gleno0h 20th July 2009 06:24

Quote:

Originally Posted by dzudzu (Post 198677)
This is just from my own research so wait for confirmation but till then u can toy around with this:

in /usr/local/ispconfig/server/plugins-enabled

file: apache2_plugin.inc.php

there is this code

// make temp direcory writable for the apache user and the website user
exec("chmod 777 ".escapeshellcmd($data["new"]["document_root"]."/tmp"));

i belive u can add another line below with appropriate chmod like 755 so it gets created

as example u asked i guess it would be something like:
exec("chmod 755 ".escapeshellcmd($data["new"]["document_root"]."/extra"));

thou note that index file is in web folder so i guess u maybe want to make /web/extra

just few of my thoughts

Well that didnt do it. Its too bad i could find a tut about it, but thanks to you i got in a direction and managed to do it.

Small tutorial:

nano /usr/local/ispconfig/server/plugins-enabled/apache2_plug*
find the text containing:
Code:

// Check if the directories are there and create them if nescessary.
if(!is_dir($data["new"]["document_root"]."/web")) exec("mkdir -p ".$data["new"]["document_root"]."/web");
if(!is_dir($data["new"]["document_root"]."/web/error") and $data["new"]["errordocs"]) exec("mkdir -p ".$data["new"]["document_root"]."/web/error");
//if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log");
if(!is_dir($data["new"]["document_root"]."/ssl")) exec("mkdir -p ".$data["new"]["document_root"]."/ssl");
if(!is_dir($data["new"]["document_root"]."/cgi-bin")) exec("mkdir -p ".$data["new"]["document_root"]."/cgi-bin");
if(!is_dir($data["new"]["document_root"]."/tmp")) exec("mkdir -p ".$data["new"]["document_root"]."/tmp");

then add this at the end

Code:

if(!is_dir($data["new"]["document_root"]."/web/extra")) exec("mkdir -p ".$data["new"]["document_root"]."/web/extra");
so it becomes;

Code:

// Check if the directories are there and create them if nescessary.
if(!is_dir($data["new"]["document_root"]."/web")) exec("mkdir -p ".$data["new"]["document_root"]."/web");
if(!is_dir($data["new"]["document_root"]."/web/error") and $data["new"]["errordocs"]) exec("mkdir -p ".$data["new"]["document_root"]."/web/error");
//if(!is_dir($data["new"]["document_root"]."/log")) exec("mkdir -p ".$data["new"]["document_root"]."/log");
if(!is_dir($data["new"]["document_root"]."/ssl")) exec("mkdir -p ".$data["new"]["document_root"]."/ssl");
if(!is_dir($data["new"]["document_root"]."/cgi-bin")) exec("mkdir -p ".$data["new"]["document_root"]."/cgi-bin");
if(!is_dir($data["new"]["document_root"]."/tmp")) exec("mkdir -p ".$data["new"]["document_root"]."/tmp");
if(!is_dir($data["new"]["document_root"]."/web/extra")) exec("mkdir -p ".$data["new"]["document_root"]."/web/extra");

That makes an extra dir, and for the joomla installer i did this;

Look for

Code:

// copy the standard index page
if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))){
exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"][$
}
else {
if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")){
exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");    $
}
else {
exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]$
exec("cp /usr/local/ispconfig/server/conf/index/favicon.ico ".escapeshellcmd($data["new"]["document_root"])."/web/");
exec("cp /usr/local/ispconfig/server/conf/index/robots.txt ".escapeshellcmd($data["new"]["document_root"])."/web/");
exec("cp /usr/local/ispconfig/server/conf/index/.htaccess ".escapeshellcmd($data["new"]["document_root"])."/web/");
}
}
exec("chmod -R a+r ".escapeshellcmd($data["new"]["document_root"])."/web/");

then add this

Code:

exec("cp /usr/local/ispconfig/server/conf/installers/installapps.php ".escapeshellcmd($data["new"]["document_root"])."/web/extra/");
so it becomes;

Code:

// copy the standard index page
if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2))){
exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"][$
}
else {
if (file_exists("/usr/local/ispconfig/server/conf-custom/index/standard_index.html")){
exec("cp /usr/local/ispconfig/server/conf-custom/index/standard_index.html ".escapeshellcmd($data["new"]["document_root"])."/web/index.html");    $
}
else {
exec("cp /usr/local/ispconfig/server/conf/index/standard_index.html_".substr(escapeshellcmd($conf["language"]),0,2)." ".escapeshellcmd($data["new"]$
exec("cp /usr/local/ispconfig/server/conf/index/favicon.ico ".escapeshellcmd($data["new"]["document_root"])."/web/");
exec("cp /usr/local/ispconfig/server/conf/index/robots.txt ".escapeshellcmd($data["new"]["document_root"])."/web/");
exec("cp /usr/local/ispconfig/server/conf/index/.htaccess ".escapeshellcmd($data["new"]["document_root"])."/web/");
exec("cp /usr/local/ispconfig/server/conf/installers/installapps.php ".escapeshellcmd($data["new"]["document_root"])."/web/extra/");
}
}
exec("chmod -R a+r ".escapeshellcmd($data["new"]["document_root"])."/web/");

Dont forget, /usr/local/ispconfig/server/conf/INSTALLER/ is a custom dir, you have to make that, but it also could by phpmyadmin for that matther.

Thnx!

dzudzu 20th July 2009 14:14

ah yes, my command just chmods the dir, didn't pay attention silly me, but great you worked it out :)

Gleno0h 20th July 2009 16:53

Quote:

Originally Posted by dzudzu (Post 198712)
ah yes, my command just chmods the dir, didn't pay attention silly me, but great you worked it out :)

Well thats also one thing i needed. "Extra" has to be 777 otherwise it cant make a temp folder when it unzip's .zip packages.
Then its moved to a folder that the user wants to use and the script chmod's the default folders that needs to have a certain chmod for instalation. Works like a charm!


All times are GMT +2. The time now is 01:19.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.