From d4589e1ed6fe33b7329cd6076db6240384a37509 Mon Sep 17 00:00:00 2001 From: Dmitry Teselkin Date: Fri, 31 Oct 2014 09:25:09 +0300 Subject: [PATCH] Fix vhost configuration sections According to https://wiki.apache.org/httpd/CommonMisconfigurations is is wrong to specify server name in opening tag. ServerName should be used instead. Indentations also fixed in some files. Change-Id: Id9d20a672103221efa01be61a174b62706036e57 --- .../templates/etherpadlite.vhost.erb | 5 +- modules/gerrit/templates/gerrit.vhost.erb | 5 +- modules/logstash/templates/kibana.vhost.erb | 50 +++++++++---------- modules/logstash/templates/logstash.vhost.erb | 16 +++--- .../nodepool/templates/nodepool-log.vhost.erb | 3 +- modules/openstackid/templates/vhost.erb | 5 +- modules/zuul/templates/zuul.vhost.erb | 3 +- 7 files changed, 46 insertions(+), 41 deletions(-) diff --git a/modules/etherpad_lite/templates/etherpadlite.vhost.erb b/modules/etherpad_lite/templates/etherpadlite.vhost.erb index b77aa10848..e6711bb950 100644 --- a/modules/etherpad_lite/templates/etherpadlite.vhost.erb +++ b/modules/etherpad_lite/templates/etherpadlite.vhost.erb @@ -1,4 +1,5 @@ -:80> + + ServerName <%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> ServerAdmin <%= scope.lookupvar("etherpad_lite::apache::serveradmin") %> ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("etherpad_lite::apache::vhost_name") %>-error.log @@ -12,7 +13,7 @@ -:443> + ServerName <%= scope.lookupvar("etherpad_lite::apache::vhost_name") %> ServerAdmin <%= scope.lookupvar("etherpad_lite::apache::serveradmin") %> diff --git a/modules/gerrit/templates/gerrit.vhost.erb b/modules/gerrit/templates/gerrit.vhost.erb index 2e1a48851f..dcd7fe8863 100644 --- a/modules/gerrit/templates/gerrit.vhost.erb +++ b/modules/gerrit/templates/gerrit.vhost.erb @@ -1,4 +1,5 @@ -:80> + + ServerName <%= scope.lookupvar("gerrit::vhost_name") %> ServerAdmin <%= scope.lookupvar("gerrit::serveradmin") %> ErrorLog ${APACHE_LOG_DIR}/gerrit-error.log @@ -12,7 +13,7 @@ -:443> + ServerName <%= scope.lookupvar("gerrit::vhost_name") %> ServerAdmin <%= scope.lookupvar("gerrit::serveradmin") %> AllowEncodedSlashes NoDecode diff --git a/modules/logstash/templates/kibana.vhost.erb b/modules/logstash/templates/kibana.vhost.erb index a14cd3c451..786f3586e0 100644 --- a/modules/logstash/templates/kibana.vhost.erb +++ b/modules/logstash/templates/kibana.vhost.erb @@ -1,31 +1,31 @@ -:80> - ServerName <%= scope.lookupvar("::logstash::web::vhost_name") %> - ServerAdmin <%= scope.lookupvar("::logstash::web::serveradmin") %> + + ServerName <%= scope.lookupvar("::logstash::web::vhost_name") %> + ServerAdmin <%= scope.lookupvar("::logstash::web::serveradmin") %> - ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-error.log + ErrorLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-error.log - LogLevel warn + LogLevel warn - CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-access.log combined + CustomLog ${APACHE_LOG_DIR}/<%= scope.lookupvar("::logstash::web::vhost_name") %>-access.log combined - - <% if @proxy_elasticsearch == true %> - # Proxy GETs for elasticsearch .*/_aliases, .*/_status, .*/_search, - # .*/_mapping, .*/_mapping/field/.*, _cluster/health, and _nodes. - RewriteEngine on - RewriteCond %{REQUEST_METHOD} GET - RewriteRule ^/elasticsearch/((.*/)?_aliases|(.*/)?_status|(.*/)?_search|(.*/)?_mapping|(.*/)?_mapping/field/(.*)?|_cluster/health|_nodes)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P] - RewriteCond %{REQUEST_METHOD} POST - RewriteRule ^/elasticsearch/(_aliases|(.*/)?_search)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P] - RewriteCond %{REQUEST_METHOD} OPTIONS - RewriteRule ^/elasticsearch/((.*/)?_search)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P] - /> - ProxySet connectiontimeout=15 timeout=120 - - ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/ - <% end %> + + <% if @proxy_elasticsearch == true %> + # Proxy GETs for elasticsearch .*/_aliases, .*/_status, .*/_search, + # .*/_mapping, .*/_mapping/field/.*, _cluster/health, and _nodes. + RewriteEngine on + RewriteCond %{REQUEST_METHOD} GET + RewriteRule ^/elasticsearch/((.*/)?_aliases|(.*/)?_status|(.*/)?_search|(.*/)?_mapping|(.*/)?_mapping/field/(.*)?|_cluster/health|_nodes)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P] + RewriteCond %{REQUEST_METHOD} POST + RewriteRule ^/elasticsearch/(_aliases|(.*/)?_search)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P] + RewriteCond %{REQUEST_METHOD} OPTIONS + RewriteRule ^/elasticsearch/((.*/)?_search)$ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/$1 [P] + /> + ProxySet connectiontimeout=15 timeout=120 + + ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::discover_nodes")[0] %>/ + <% end %> - ProxyPass / http://127.0.0.1:5601/ retry=0 - ProxyPassReverse / http://127.0.0.1:5601/ - + ProxyPass / http://127.0.0.1:5601/ retry=0 + ProxyPassReverse / http://127.0.0.1:5601/ + diff --git a/modules/logstash/templates/logstash.vhost.erb b/modules/logstash/templates/logstash.vhost.erb index ef73a6a034..345c649d4d 100644 --- a/modules/logstash/templates/logstash.vhost.erb +++ b/modules/logstash/templates/logstash.vhost.erb @@ -1,13 +1,13 @@ -:80> - ServerName <%= @vhost_name %> - ServerAdmin <%= @serveradmin %> + + ServerName <%= @vhost_name %> + ServerAdmin <%= @serveradmin %> - ErrorLog ${APACHE_LOG_DIR}/<%= @vhost_name %>-error.log + ErrorLog ${APACHE_LOG_DIR}/<%= @vhost_name %>-error.log - LogLevel warn + LogLevel warn - CustomLog ${APACHE_LOG_DIR}/<%= @vhost_name %>-access.log combined + CustomLog ${APACHE_LOG_DIR}/<%= @vhost_name %>-access.log combined - ProxyPass / http://127.0.0.1:9292/ retry=0 - ProxyPassReverse / http://127.0.0.1:9292/ + ProxyPass / http://127.0.0.1:9292/ retry=0 + ProxyPassReverse / http://127.0.0.1:9292/ diff --git a/modules/nodepool/templates/nodepool-log.vhost.erb b/modules/nodepool/templates/nodepool-log.vhost.erb index 3e2e2408fa..35b3062cbf 100644 --- a/modules/nodepool/templates/nodepool-log.vhost.erb +++ b/modules/nodepool/templates/nodepool-log.vhost.erb @@ -1,4 +1,5 @@ -:80> + + ServerName <%= scope.lookupvar("nodepool::vhost_name") %> DocumentRoot <%= scope.lookupvar("nodepool::image_log_document_root") %> > diff --git a/modules/openstackid/templates/vhost.erb b/modules/openstackid/templates/vhost.erb index f02169704c..9980ea4335 100644 --- a/modules/openstackid/templates/vhost.erb +++ b/modules/openstackid/templates/vhost.erb @@ -1,4 +1,5 @@ -:80> + + ServerName <%= scope.lookupvar("openstackid::vhost_name") %> ServerAdmin <%= scope.lookupvar("openstackid::serveradmin") %> ErrorLog ${APACHE_LOG_DIR}/openstackid-error.log @@ -10,7 +11,7 @@ -:443> + ServerName <%= scope.lookupvar("openstackid::vhost_name") %> ServerAdmin <%= scope.lookupvar("openstackid::serveradmin") %> diff --git a/modules/zuul/templates/zuul.vhost.erb b/modules/zuul/templates/zuul.vhost.erb index ba31723b34..b0ed6694df 100644 --- a/modules/zuul/templates/zuul.vhost.erb +++ b/modules/zuul/templates/zuul.vhost.erb @@ -1,4 +1,5 @@ -:80> + + ServerName <%= scope.lookupvar("::zuul::vhost_name") %> ServerAdmin <%= scope.lookupvar("::zuul::serveradmin") %> DocumentRoot /var/lib/zuul/www