Korrektur Apache Konfiguration
This commit is contained in:
parent
33d6b04df0
commit
389c9f23c4
@ -8,8 +8,8 @@ public class CreateFileProcessor extends AbstractProcessor {
|
|||||||
|
|
||||||
private CompoundProcessor compoundProcessor;
|
private CompoundProcessor compoundProcessor;
|
||||||
|
|
||||||
public CreateFileProcessor(String templateName, Map<String, String> templateValues, String targetPath, String owner, String group, String modeMask) throws ProcessorException {
|
public CreateFileProcessor(String templateName, Map<String, String> templateValues, String targetPath, String owner, String group, String modeMask, boolean overwriteTarget) throws ProcessorException {
|
||||||
TemplateProcessor templateProcessor = new TemplateProcessor(templateName, templateValues, targetPath, false);
|
TemplateProcessor templateProcessor = new TemplateProcessor(templateName, templateValues, targetPath, overwriteTarget);
|
||||||
ShellProcessor shellProcessor =
|
ShellProcessor shellProcessor =
|
||||||
new ShellProcessor(
|
new ShellProcessor(
|
||||||
"chown " + owner + ":" + group + " " + targetPath + " && " +
|
"chown " + owner + ":" + group + " " + targetPath + " && " +
|
||||||
|
@ -217,24 +217,24 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
}
|
}
|
||||||
templateVars.put("PROTOCOL", "http");
|
templateVars.put("PROTOCOL", "http");
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs/.htaccess", userName, pacName, "644")
|
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs/.htaccess", userName, pacName, "644", false)
|
||||||
);
|
);
|
||||||
templateVars.put("PROTOCOL", "https");
|
templateVars.put("PROTOCOL", "https");
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs-ssl/.htaccess", userName, pacName, "644")
|
new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs-ssl/.htaccess", userName, pacName, "644", false)
|
||||||
);
|
);
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs/www/index.html", userName, pacName, "644")
|
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs/www/index.html", userName, pacName, "644", false)
|
||||||
);
|
);
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644")
|
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644", false)
|
||||||
);
|
);
|
||||||
if (dynamicWeb) {
|
if (dynamicWeb) {
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi/test.cgi", userName, pacName, "755")
|
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi/test.cgi", userName, pacName, "755", false)
|
||||||
);
|
);
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi-ssl/test.cgi", userName, pacName, "755")
|
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi-ssl/test.cgi", userName, pacName, "755", false)
|
||||||
);
|
);
|
||||||
domDirsProcessor.appendProcessor(
|
domDirsProcessor.appendProcessor(
|
||||||
new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755")
|
new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755")
|
||||||
@ -254,16 +254,18 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
private Processor createApacheVHostSetupProcessor(Domain dom, Map<String, String> templateVars)
|
private Processor createApacheVHostSetupProcessor(Domain dom, Map<String, String> templateVars)
|
||||||
throws ProcessorException {
|
throws ProcessorException {
|
||||||
String domName = dom.getName();
|
String domName = dom.getName();
|
||||||
|
int level = domName.split("\\.").length;
|
||||||
|
String linkPrefix = Integer.toString(100 - level);
|
||||||
String pac = dom.getUser().getPac().getName();
|
String pac = dom.getUser().getPac().getName();
|
||||||
Processor domSetupProcessor = new CompoundProcessor(
|
Processor domSetupProcessor = new CompoundProcessor(
|
||||||
createDomainDirectoriesProcessor(dom, templateVars),
|
createDomainDirectoriesProcessor(dom, templateVars),
|
||||||
new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-generated/" + domName, "root", "root", "644"),
|
new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-available/" + domName, "root", "root", "644", true),
|
||||||
new ShellProcessor("ls /etc/apache2/pems/" + pac + ".pem >/dev/null 2>&1 " +
|
new ShellProcessor("ls /etc/apache2/pems/" + pac + ".pem >/dev/null 2>&1 " +
|
||||||
"&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-generated/" + domName +
|
"&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-available/" + domName +
|
||||||
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-generated/" + domName + ")" +
|
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ")" +
|
||||||
" || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-generated/" + domName),
|
" || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName),
|
||||||
new ShellProcessor(
|
new ShellProcessor(
|
||||||
"ln -sf /etc/apache2/sites-generated/" + domName + " /etc/apache2/sites-enabled/010-" + domName +
|
"ln -sf /etc/apache2/sites-available/" + domName + " /etc/apache2/sites-enabled/" + linkPrefix + "-"+ domName +
|
||||||
" && invoke-rc.d apache2 reload >/dev/null 2>&1")
|
" && invoke-rc.d apache2 reload >/dev/null 2>&1")
|
||||||
);
|
);
|
||||||
return domSetupProcessor;
|
return domSetupProcessor;
|
||||||
@ -274,7 +276,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
|||||||
Processor vhostDelProcessor =
|
Processor vhostDelProcessor =
|
||||||
new ShellProcessor("rm /home/doms/" + domName +
|
new ShellProcessor("rm /home/doms/" + domName +
|
||||||
" && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
|
" && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName +
|
||||||
" && rm /etc/apache2/sites-generated/" + domName +
|
" && rm /etc/apache2/sites-available/" + domName +
|
||||||
" && rm /etc/apache2/sites-*/`ls -1 /etc/apache2/sites-enabled/ | egrep \"^[01]+-" + domName + "$\"`" +
|
" && rm /etc/apache2/sites-*/`ls -1 /etc/apache2/sites-enabled/ | egrep \"^[01]+-" + domName + "$\"`" +
|
||||||
" && invoke-rc.d apache2 reload >/dev/null 2>&1");
|
" && invoke-rc.d apache2 reload >/dev/null 2>&1");
|
||||||
return vhostDelProcessor;
|
return vhostDelProcessor;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
<!-- BEGIN: main -->NameVirtualHost {DOM_IPNUMBER}:80
|
<!-- BEGIN: main --><VirtualHost {DOM_IPNUMBER}:80 {DOM_IPNUMBEREX}:80>
|
||||||
NameVirtualHost {DOM_IPNUMBEREX}:80
|
|
||||||
|
|
||||||
<VirtualHost {DOM_IPNUMBER}:80 {DOM_IPNUMBEREX}:80>
|
|
||||||
|
|
||||||
ServerName {DOM_HOSTNAME}
|
ServerName {DOM_HOSTNAME}
|
||||||
ServerAlias *.{DOM_HOSTNAME}
|
ServerAlias *.{DOM_HOSTNAME}
|
||||||
@ -34,9 +31,6 @@ NameVirtualHost {DOM_IPNUMBEREX}:80
|
|||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
#RewriteLog /home/doms/{DOM_HOSTNAME}/var/rewrite.log
|
|
||||||
#RewriteLogLevel 9
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
||||||
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
||||||
@ -48,9 +42,6 @@ NameVirtualHost {DOM_IPNUMBEREX}:80
|
|||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
NameVirtualHost {DOM_IPNUMBER}:443
|
|
||||||
NameVirtualHost {DOM_IPNUMBEREX}:443
|
|
||||||
|
|
||||||
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBEREX}:443>
|
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBEREX}:443>
|
||||||
|
|
||||||
ServerName {DOM_HOSTNAME}
|
ServerName {DOM_HOSTNAME}
|
||||||
@ -91,9 +82,6 @@ NameVirtualHost {DOM_IPNUMBEREX}:443
|
|||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
#RewriteLog /home/doms/{DOM_HOSTNAME}/var/rewrite.log
|
|
||||||
#RewriteLogLevel 9
|
|
||||||
|
|
||||||
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
RewriteCond %{REQUEST_URI} !^/cgi-bin/
|
||||||
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
RewriteCond %{REQUEST_URI} !^/fastcgi-bin/
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
<!-- BEGIN: main -->NameVirtualHost {DOM_IPNUMBER}:80
|
<!-- BEGIN: main --><VirtualHost {DOM_IPNUMBER}:80 {DOM_IPNUMBEREX}:80>
|
||||||
NameVirtualHost {DOM_IPNUMBEREX}:80
|
|
||||||
|
|
||||||
<VirtualHost {DOM_IPNUMBER}:80 {DOM_IPNUMBEREX}:80>
|
|
||||||
|
|
||||||
ServerName {DOM_HOSTNAME}
|
ServerName {DOM_HOSTNAME}
|
||||||
ServerAlias *.{DOM_HOSTNAME}
|
ServerAlias *.{DOM_HOSTNAME}
|
||||||
@ -29,18 +26,12 @@ NameVirtualHost {DOM_IPNUMBEREX}:80
|
|||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
#RewriteLog /home/doms/{DOM_HOSTNAME}/var/rewrite.log
|
|
||||||
#RewriteLogLevel 9
|
|
||||||
|
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:80)?$ [novary]
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} -d
|
RewriteCond /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1} -d
|
||||||
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1}$1 [last]
|
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs/${tolower:%1}$1 [last]
|
||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
NameVirtualHost {DOM_IPNUMBER}:443
|
|
||||||
NameVirtualHost {DOM_IPNUMBEREX}:443
|
|
||||||
|
|
||||||
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBEREX}:443>
|
<VirtualHost {DOM_IPNUMBER}:443 {DOM_IPNUMBEREX}:443>
|
||||||
|
|
||||||
ServerName {DOM_HOSTNAME}
|
ServerName {DOM_HOSTNAME}
|
||||||
@ -76,9 +67,6 @@ NameVirtualHost {DOM_IPNUMBEREX}:443
|
|||||||
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
RewriteOptions Inherit
|
RewriteOptions Inherit
|
||||||
#RewriteLog /home/doms/{DOM_HOSTNAME}/var/rewrite.log
|
|
||||||
#RewriteLogLevel 9
|
|
||||||
|
|
||||||
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
RewriteCond %{HTTP_HOST} ^(.+)\.{DOM_HOSTNAME}\.?(:443)?$ [novary]
|
||||||
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
RewriteCond /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1} -d
|
||||||
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
RewriteRule ^(.*) /home/doms/{DOM_HOSTNAME}/subs-ssl/${tolower:%1}$1 [last]
|
||||||
|
Loading…
Reference in New Issue
Block a user