mk-httpd-conf entfaellt

This commit is contained in:
Peter Hormanns 2011-07-15 13:45:37 +00:00
parent bbb8ae1767
commit c16d9213d0
2 changed files with 120 additions and 3 deletions

View File

@ -33,12 +33,16 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
Domain dom = (Domain) entity;
UnixUser domUser = dom.getUser();
Pac pac = domUser.getPac();
String pacName = pac.getName();
String domName = dom.getName();
String zonefileTargetPath = "/etc/bind/pri." + domName;
Map<String, String> templateVars = new HashMap<String, String>();
templateVars.put("SIO", Long.toString(System.currentTimeMillis()/1000L));
templateVars.put("PAC", pacName);
templateVars.put("HIVE", pac.getHiveName());
templateVars.put("DOM_HOSTNAME", domName);
templateVars.put("PAC_HOSTNAME", pac.getName() + ".hostsharing.net");
templateVars.put("DOM_USERNAME", domUser.getName());
templateVars.put("PAC_HOSTNAME", pacName + ".hostsharing.net");
templateVars.put("DOM_IPNUMBER", pac.getCurINetAddr().getInetAddr());
Processor zonefileTemplateProcessor =
new TemplateProcessor("/de/hsadmin/mods/dom/zonefile.jtpl", templateVars, zonefileTargetPath, false);
@ -95,7 +99,6 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
String domsDir = domUser.getHomedir() + "/doms";
String domainDir = domsDir + "/" + dom.getName();
String[] subDirs = new String[] { "htdocs", "htdocs-ssl", "subs", "subs/www", "subs-ssl", "subs-ssl/www", "cgi", "fastcgi", "cgi-ssl", "fastcgi-ssl", "etc", "var" };
String pacName = pac.getName();
String userName = domUser.getName();
Processor mkDomainDirProzessor =
new ShellProcessor(
@ -112,8 +115,17 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
));
}
templateVars = new HashMap<String, String>();
templateVars.put("PAC", pacName);
templateVars.put("HIVE", pac.getHiveName());
templateVars.put("DOM_HOSTNAME", domName);
templateVars.put("DOM_USERNAME", domUser.getName());
templateVars.put("PAC_HOSTNAME", pacName + ".hostsharing.net");
templateVars.put("DOM_IPNUMBER", pac.getCurINetAddr().getInetAddr());
templateVars.put("DOMAIN", domName);
templateVars.put("USER_NAME", domUser.getComment());
domDirsProcessor.appendProcessor(
new CreateFileProcessor("/de/hsadmin/mods/dom/httpd.conf.jtpl", templateVars, "/etc/apache2/sites-generated/" + domName, "root", "root", "644")
);
templateVars.put("PROTOCOL", "http");
domDirsProcessor.appendProcessor(
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs/.htaccess", userName, pacName, "644")
@ -148,7 +160,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
mainProcessor.appendProcessor(hiveName, domDirsProcessor, "Setup doms/" + domName + "-Directory");
Processor domSetupProcessor =
new ShellProcessor("mk-httpd-conf " + pacName + " && invoke-rc.d apache2 reload >/dev/null 2>&1");
new ShellProcessor("ln -s /etc/apache2/sites-generated/" + domName + " /etc/apache2/sites-enabled/010" + domName + " && invoke-rc.d apache2 reload >/dev/null 2>&1");
mainProcessor.appendProcessor(hiveName, domSetupProcessor, "Setup Apache VHost");
return mainProcessor;
}

View File

@ -0,0 +1,105 @@
NameVirtualHost {DOM_IPNUMBER}:80
NameVirtualHost {DOM_IPNUMBER}:80
<VirtualHost {DOM_IPNUMBER}:80 {DOM_IPNUMBER}:80>
ServerName {DOM_HOSTNAME}
ServerAlias *.{DOM_HOSTNAME}
ServerAdmin {DOM_USERNAME}@{HIVE}.hostsharing.net
SuexecUserGroup {DOM_USERNAME} {PAC}
DocumentRoot /home/doms/{DOM_HOSTNAME}/htdocs
Alias /cgi-bin/ /home/doms/{DOM_HOSTNAME}/cgi/
Alias /fastcgi-bin/ /home/doms/{DOM_HOSTNAME}/fastcgi/
<Directory />
Options -ExecCGI +IncludesNOEXEC +Indexes +MultiViews +SymLinksIfOwnerMatch
</Directory>
<Directory /home/doms/{DOM_HOSTNAME}/>
AllowOverride AuthConfig FileInfo Indexes Limit
</Directory>
<Location /cgi-bin/>
SetHandler cgi-script
Options +ExecCGI -Indexes -MultiViews
</Location>
<Location /fastcgi-bin/>
SetHandler fcgid-script
Options +ExecCGI -Indexes -MultiViews
</Location>
RewriteEngine On
RewriteOptions Inherit
#RewriteLog /home/doms/{DOM_HOSTNAME}/var/rewrite.log
#RewriteLogLevel 9
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} -d
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1}$1 [last]
AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub
</VirtualHost>
NameVirtualHost {DOM_IPNUMBER}:443
NameVirtualHost {DOM_IPNUMBER}:443
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBER}:443>
ServerName {DOM_HOSTNAME}
ServerAlias *.{DOM_HOSTNAME}
ServerAdmin {DOM_USERNAME}@{HIVE}.hostsharing.net
SuexecUserGroup {DOM_USERNAME} {PAC}
SSLEngine On
SSLCertificateFile /etc/apache2/pems/default.pem
SSLCertificateChainFile /etc/apache2/pems/default.chain.pem
DocumentRoot /home/doms/{DOM_HOSTNAME}/htdocs-ssl
Alias /cgi-bin/ /home/doms/{DOM_HOSTNAME}/cgi-ssl/
Alias /fastcgi-bin/ /home/doms/{DOM_HOSTNAME}/fastcgi-ssl/
<Directory />
SSLRequireSSL On
Options -ExecCGI +IncludesNOEXEC +Indexes +MultiViews +SymLinksIfOwnerMatch
</Directory>
<Directory /home/doms/{DOM_HOSTNAME}/>
AllowOverride AuthConfig FileInfo Indexes Limit
</Directory>
<Location /cgi-bin/>
SetHandler cgi-script
Options +ExecCGI -Indexes -MultiViews
</Location>
<Location /fastcgi-bin/>
SetHandler fcgid-script
Options +ExecCGI -Indexes -MultiViews
</Location>
RewriteEngine On
RewriteOptions Inherit
#RewriteLog /home/doms/{DOM_HOSTNAME}/var/rewrite.log
#RewriteLogLevel 9
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub
</VirtualHost>