Introduced Phusion Passenger for Dynamic Web.

This commit is contained in:
Michael Hierweck 2014-08-12 16:13:26 +02:00
parent a9361aa80c
commit ee5e33f3fe
2 changed files with 35 additions and 33 deletions

View File

@ -247,20 +247,12 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
domDirsProcessor.appendProcessor( domDirsProcessor.appendProcessor(
new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.vm", templateVars, dom, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644", false) new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.vm", templateVars, dom, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644", false)
); );
if (dom.isDynamic()) { domDirsProcessor.appendProcessor(
domDirsProcessor.appendProcessor( new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755")
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.vm", templateVars, dom, domainDir + "/cgi/test.cgi", userName, pacName, "755", false) );
); domDirsProcessor.appendProcessor(
domDirsProcessor.appendProcessor( new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi-ssl/phpstub", userName, pacName, "755")
new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.vm", templateVars, dom, domainDir + "/cgi-ssl/test.cgi", userName, pacName, "755", false)
);
domDirsProcessor.appendProcessor(
new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755")
);
domDirsProcessor.appendProcessor(
new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi-ssl/phpstub", userName, pacName, "755")
); );
}
domDirsProcessor.appendProcessor( domDirsProcessor.appendProcessor(
new ShellProcessor("ln -sf " + domainDir + " /home/doms/ && " + new ShellProcessor("ln -sf " + domainDir + " /home/doms/ && " +
"chown --no-dereference " + userName + ":httpd /home/doms/" + domName "chown --no-dereference " + userName + ":httpd /home/doms/" + domName
@ -283,7 +275,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
ifOption(templateVars, query, "multiviews", "+MultiViews", "-MultiViews"); ifOption(templateVars, query, "multiviews", "+MultiViews", "-MultiViews");
ifOption(templateVars, query, "htdocsfallback", Boolean.TRUE, Boolean.FALSE); ifOption(templateVars, query, "htdocsfallback", Boolean.TRUE, Boolean.FALSE);
Processor domSetupProcessor = new CompoundProcessor( Processor domSetupProcessor = new CompoundProcessor(
new CreateFileProcessor("/de/hsadmin/mods/dom/httpd-vhost.vm", templateVars, dom, "/etc/apache2/sites-available/" + domName + ".tmp", "root", "root", "644", true), new CreateFileProcessor("/de/hsadmin/mods/dom/apache-vhost.vm", templateVars, dom, "/etc/apache2/sites-available/" + domName + ".tmp", "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-available/" + domName + ".tmp" + " && sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-available/" + domName + ".tmp" +
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp )" + " && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp )" +

View File

@ -4,26 +4,30 @@
# #
<VirtualHost ${pac.curINetAddr.inetAddr}:80 ${pac.oldINetAddr.inetAddr}:80> <VirtualHost ${pac.curINetAddr.inetAddr}:80 ${pac.oldINetAddr.inetAddr}:80>
ServerName ${dom.name} ServerName ${dom.name}
ServerAlias *.${dom.name} ServerAlias *.${dom.name}
ServerAdmin webmaster@${dom.name} ServerAdmin webmaster@${dom.name}
SuexecUserGroup ${dom.user.name} ${pac.name} SuexecUserGroup ${dom.user.name} ${pac.name}
#if( ${dynamicWeb} )
PassengerEnabled on
PassengerUser ${dom.user.name}
PassengerGroup ${pac.name}
PassengerAppRoot /home/doms/${dom.name}/app/
#end
DocumentRoot /home/doms/${dom.name}/htdocs DocumentRoot /home/doms/${dom.name}/htdocs
#if( ${dynamicWeb} )
Alias /cgi-bin/ /home/doms/${dom.name}/cgi/ Alias /cgi-bin/ /home/doms/${dom.name}/cgi/
Alias /fastcgi-bin/ /home/doms/${dom.name}/fastcgi/ Alias /fastcgi-bin/ /home/doms/${dom.name}/fastcgi/
#end
<Directory /> <Directory />
Options -ExecCGI ${includes} ${indexes} ${multiviews} +SymLinksIfOwnerMatch Options -ExecCGI ${includes} ${indexes} ${multiviews} +SymLinksIfOwnerMatch
</Directory> </Directory>
<Directory /home/doms/${dom.name}/> <Directory /home/doms/${dom.name}/>
AllowOverride AuthConfig FileInfo Indexes Limit AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
</Directory> </Directory>
#if( ${dynamicWeb} ) #if( ${dynamicWeb} )
@ -31,16 +35,18 @@
SetHandler cgi-script SetHandler cgi-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else
<Location /cgi-bin/>
Redirect 501 /
</Location>
#end
#if( ${dynamicWeb} )
<Location /fastcgi-bin/> <Location /fastcgi-bin/>
SetHandler fcgid-script SetHandler fcgid-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else #else
<Location /cgi-bin/>
Redirect 501 /
</Location>
<Location /fastcgi-bin/> <Location /fastcgi-bin/>
Redirect 501 / Redirect 501 /
</Location> </Location>
@ -67,29 +73,32 @@
AddType application/x-httpd-php .php .php5 .php4 .php3 AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub Action application/x-httpd-php /fastcgi-bin/phpstub
#end #end
</VirtualHost> </VirtualHost>
<VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.oldINetAddr.inetAddr}:443> <VirtualHost ${pac.curINetAddr.inetAddr}:443 ${pac.oldINetAddr.inetAddr}:443>
ServerName ${dom.name} ServerName ${dom.name}
ServerAlias *.${dom.name} ServerAlias *.${dom.name}
ServerAdmin ${dom.user.name}@${dom.name} ServerAdmin ${dom.user.name}@${dom.name}
SuexecUserGroup ${dom.user.name} ${pac.name} SuexecUserGroup ${dom.user.name} ${pac.name}
#if( ${dynamicWeb} )
PassengerEnabled on
PassengerUser ${dom.user.name}
PassengerGroup ${pac.name}
PassengerAppRoot /home/doms/${dom.name}/app-ssl/
#end
SSLEngine On SSLEngine On
SSLCertificateFile /etc/apache2/pems/default.pem SSLCertificateFile /etc/apache2/pems/default.pem
SSLCertificateChainFile /etc/apache2/pems/default.chain.pem SSLCertificateChainFile /etc/apache2/pems/default.chain.pem
SSLCertificateFile /etc/apache2/pems/${pac.name}.pem SSLCertificateFile /etc/apache2/pems/${pac.name}.pem
SSLCertificateChainFile /etc/apache2/pems/${pac.name}.chain.pem SSLCertificateChainFile /etc/apache2/pems/${pac.name}.chain.pem
DocumentRoot /home/doms/${dom.name}/htdocs-ssl DocumentRoot /home/doms/${dom.name}/htdocs-ssl
#if( ${dynamicWeb} )
Alias /cgi-bin/ /home/doms/${dom.name}/cgi-ssl/ Alias /cgi-bin/ /home/doms/${dom.name}/cgi-ssl/
Alias /fastcgi-bin/ /home/doms/${dom.name}/fastcgi-ssl/ Alias /fastcgi-bin/ /home/doms/${dom.name}/fastcgi-ssl/
#end
<Directory /> <Directory />
SSLRequireSSL On SSLRequireSSL On
@ -97,7 +106,7 @@
</Directory> </Directory>
<Directory /home/doms/${dom.name}/> <Directory /home/doms/${dom.name}/>
AllowOverride AuthConfig FileInfo Indexes Limit AllowOverride AuthConfig FileInfo Indexes Limit Options=Includes,Indexes,MultiViews,PassengerNodejs,PassengerPython,PassengerRuby,PassengerAppEnv
</Directory> </Directory>
#if( ${dynamicWeb} ) #if( ${dynamicWeb} )
@ -105,16 +114,18 @@
SetHandler cgi-script SetHandler cgi-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else
<Location /cgi-bin/>
Redirect 501 /
</Location>
#end
#if( ${dynamicWeb} )
<Location /fastcgi-bin/> <Location /fastcgi-bin/>
SetHandler fcgid-script SetHandler fcgid-script
Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch Options +ExecCGI ${includes} -Indexes -MultiViews +SymLinksIfOwnerMatch
</Location> </Location>
#else #else
<Location /cgi-bin/>
Redirect 501 /
</Location>
<Location /fastcgi-bin/> <Location /fastcgi-bin/>
Redirect 501 / Redirect 501 /
</Location> </Location>
@ -141,5 +152,4 @@
AddType application/x-httpd-php .php .php5 .php4 .php3 AddType application/x-httpd-php .php .php5 .php4 .php3
Action application/x-httpd-php /fastcgi-bin/phpstub Action application/x-httpd-php /fastcgi-bin/phpstub
#end #end
</VirtualHost> </VirtualHost>