diff options
author | Andy Carlson <bng44270@users.noreply.github.com> | 2017-02-09 09:34:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-09 09:34:37 -0500 |
commit | 9670ea300faccffbe467552941f51ccd2dbdffca (patch) | |
tree | 44f89f48c154be5efa846e96b279a3b9b9d08073 | |
parent | deaed1e4b09af0340f7a590bd0067eb6864db771 (diff) |
-rw-r--r-- | dispatcher.conf.m4 | 101 |
1 files changed, 70 insertions, 31 deletions
diff --git a/dispatcher.conf.m4 b/dispatcher.conf.m4 index 773fc61..ed66873 100644 --- a/dispatcher.conf.m4 +++ b/dispatcher.conf.m4 @@ -1,3 +1,9 @@ +Include conf/server.conf + +Listen 8080 +Listen 8443 + + <IfModule disp_apache2.c> DispatcherConfig conf/dispatcher.any DispatcherLog logs/dispatcher.log @@ -19,8 +25,9 @@ RewriteRule ^(.*)$ $target [R] </Macro> -<VirtualHost *:80> +<VirtualHost *:8080> ServerName SERVERDNSNAME + ServerAlias ${serveralias} DOCROOT RewriteEngine on @@ -51,8 +58,9 @@ HTTPREWRITE </Location> </VirtualHost> -<VirtualHost *:443> +<VirtualHost *:8443> ServerName SERVERDNSNAME + ServerAlias ${serveralias} DOCROOT SSLEngine on @@ -93,51 +101,68 @@ HTTPSREWRITE </Directory> </Macro> -<Macro AemGlobalPath $proto $path> +<Macro AemGlobalPath $proto $port $path> <Location $path> - ProxyPass $proto://SERVERDNSNAME$path - ProxyPassReverse $proto://SERVERDNSNAME$path + ProxyPass $proto://dispatcher.localhost:$port$path retry=0 + ProxyPassReverse $proto://dispatcher.localhost:$port$path </Location> </Macro> <Macro AemSite $domain $contentfolder> <VirtualHost *:80> ServerName $domain + ServerAlias www.$domain ProxyRequests Off RewriteEngine On + ProxyErrorOverride on + RewriteCond "%{REQUEST_URI}" "^/.html$" RewriteRule "^(.*)$" "http://$domain/" [R] RewriteCond "%{REQUEST_URI}" "^/$" - RewriteRule "^(.*)$" "http://SERVERDNSNAME/content/$contentfolder.html" [P] + RewriteRule "^(.*)$" "http://dispatcher.localhost:8080/content/$contentfolder.html" [P] + + RewriteCond "%{REQUEST_URI}" "^/content/$contentfolder" + RewriteRule "^/content/$contentfolder/(.*)$" "http://$domain/$1" [R] RewriteCond "%{REQUEST_URI}" ".+/$" - RewriteRule "^/(.*)/$" "http://$domain/$1.html" [R] + RewriteRule "^/(.*)[/]*$" "http://$domain/$1.html" [R] RewriteCond "%{REQUEST_URI}" !\.[a-zA-Z0-9]*$ RewriteCond "%{REQUEST_URI}" !^/content/dam RewriteRule "^/(.*)[/]*$" "http://$domain/$1.html" [R] RewriteCond "%{REQUEST_URI}" "^/.+/.html$" - RewriteRule "^/(.*)/.html$" "http://$domain/$1" [R] + RewriteRule "^/(.*)/.html$" "http://$domain/$1.html" [R] + + Header edit Location "^http://dispatcher.localhost:8080/(.*)$" "http://$domain/$1" + + IncludeOptional conf/$domain-http.con[f] + + Use AemGlobalPath http 8080 /apps + Use AemGlobalPath http 8080 /bin + Use AemGlobalPath http 8080 /etc + Use AemGlobalPath http 8080 /libs + Use AemGlobalPath http 8080 /system + Use AemGlobalPath http 8080 /content/dam + Use AemGlobalPath http 8080 /errors - Header edit Location "^http://dispatcher.localhost/(.*)$" "http://$domain/$1" + ErrorDocument 404 /errors/404.html + ErrorDocument 500 /errors/500.html - Use AemGlobalPath http /apps - Use AemGlobalPath http /bin - Use AemGlobalPath http /etc - Use AemGlobalPath http /libs - Use AemGlobalPath http /system - Use AemGlobalPath http /content/dam + ProxyPass / http://dispatcher.localhost:8080/content/$contentfolder/ retry=0 + ProxyPassReverse / http://dispatcher.localhost:8080/content/$contentfolder/ - ProxyPass / http://SERVERDNSNAME/content/$contentfolder/ - ProxyPassReverse / http://SERVERDNSNAME/content/$contentfolder/ + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined + CustomLog "|/usr/sbin/rotatelogs logs/access_log.$domain.%Y.%m.%d 86400" combined + ErrorLog "|/usr/sbin/rotatelogs /var/log/error_log.$domain.%Y.%m.%d" </VirtualHost> <VirtualHost "*:443"> ServerName $domain + ServerAlias www.$domain SSLEngine on SSLProxyEngine on @@ -147,36 +172,50 @@ HTTPSREWRITE ProxyRequests Off RewriteEngine On + ProxyErrorOverride on + RewriteCond "%{REQUEST_URI}" "^/.html$" RewriteRule "^(.*)$" "https://$domain/" [R] RewriteCond "%{REQUEST_URI}" "^/$" - RewriteRule "^(.*)$" "https://SERVERDNSNAME/content/$contentfolder.html" [P] + RewriteRule "^(.*)$" "https://dispatcher.localhost:8443/content/$contentfolder.html" [P] - RewriteCond "%{REQUEST_URI}" ".+/$" - RewriteRule "^/(.*)/$" "https://$domain/$1.html" [R] + RewriteCond "%{REQUEST_URI}" "^/content/$contentfolder" + RewriteRule "^/content/$contentfolder/(.*)$" "https://$domain/$1" [R] + RewriteCond "%{REQUEST_URI}" ".+/$" + RewriteRule "^/(.*)[/]*$" "https://$domain/$1.html" [R] RewriteCond "%{REQUEST_URI}" !\.[a-zA-Z0-9]*$ RewriteCond "%{REQUEST_URI}" !^/content/dam RewriteRule "^/(.*)[/]*$" "https://$domain/$1.html" [R] RewriteCond "%{REQUEST_URI}" "^/.+/.html$" - RewriteRule "^/(.*)/.html$" "https://$domain/$1" [R] + RewriteRule "^/(.*)/.html$" "https://$domain/$1.html" [R] - Header edit Location "^https://dispatcher.localhost/(.*)$" "https://$domain/$1" - - Use AemGlobalPath https /apps - Use AemGlobalPath https /bin - Use AemGlobalPath https /etc - Use AemGlobalPath https /libs - Use AemGlobalPath https /system - Use AemGlobalPath https /content/dam + Header edit Location "^https://dispatcher.localhost:8443/(.*)$" "https://$domain/$1" + + IncludeOptional conf/$domain-https.con[f] + + Use AemGlobalPath https 8443 /apps + Use AemGlobalPath https 8443 /bin + Use AemGlobalPath https 8443 /etc + Use AemGlobalPath https 8443 /libs + Use AemGlobalPath https 8443 /system + Use AemGlobalPath https 8443 /content/dam + Use AemGlobalPath https 8443 /errors + + ErrorDocument 404 /errors/404.html + ErrorDocument 500 /errors/500.html SSLProxyCheckPeerExpire off SSLProxyCheckPeerName off SSLProxyCheckPeerCN off - ProxyPass / https://SERVERDNSNAME/content/$contentfolder/ - ProxyPassReverse / https://SERVERDNSNAME/content/$contentfolder/ + ProxyPass / https://dispatcher.localhost:8443/content/$contentfolder/ retry=0 + ProxyPassReverse / https://dispatcher.localhost:8443/content/$contentfolder/ + + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined + CustomLog "|/usr/sbin/rotatelogs logs/access_log.$domain.%Y.%m.%d 86400" combined + ErrorLog "|/usr/sbin/rotatelogs /var/log/error_log.$domain.%Y.%m.%d" </VirtualHost> </Macro> |