Commit fd9aca8c authored by millenniumtree's avatar millenniumtree Committed by helmo

Issue #2738987 by millenniumtree, memtkmcc: Nginx unknown directive etag

parent fcbb79bb
......@@ -28,6 +28,11 @@ if (!$nginx_is_modern && $server->nginx_is_modern) {
$nginx_is_modern = $server->nginx_is_modern;
}
$nginx_has_etag = drush_get_option('nginx_has_etag');
if (!$nginx_has_etag && $server->nginx_has_etag) {
$nginx_has_etag = $server->nginx_has_etag;
}
$nginx_has_http2 = drush_get_option('nginx_has_http2');
if (!$nginx_has_http2 && $server->nginx_has_http2) {
$nginx_has_http2 = $server->nginx_has_http2;
......@@ -168,7 +173,11 @@ location ^~ /cdn/farfuture/ {
tcp_nodelay off;
access_log off;
log_not_found off;
<?php if ($nginx_has_etag): ?>
etag off;
<?php else: ?>
add_header ETag "";
<?php endif; ?>
gzip_http_version 1.0;
if_modified_since exact;
set $nocache_details "Skip";
......@@ -662,7 +671,7 @@ location ~* wysiwyg_fields/(?:plugins|scripts)/.*\.(?:js|css) {
location ~* files/advagg_(?:css|js)/ {
expires max;
access_log off;
<?php if ($nginx_is_modern): ?>
<?php if ($nginx_has_etag): ?>
etag off;
<?php else: ?>
add_header ETag "";
......
......@@ -30,6 +30,11 @@ if (!$nginx_is_modern && $server->nginx_is_modern) {
$nginx_is_modern = $server->nginx_is_modern;
}
$nginx_has_etag = drush_get_option('nginx_has_etag');
if (!$nginx_has_etag && $server->nginx_has_etag) {
$nginx_has_etag = $server->nginx_has_etag;
}
$nginx_has_http2 = drush_get_option('nginx_has_http2');
if (!$nginx_has_http2 && $server->nginx_has_http2) {
$nginx_has_http2 = $server->nginx_has_http2;
......
......@@ -28,6 +28,11 @@ if (!$nginx_is_modern && $server->nginx_is_modern) {
$nginx_is_modern = $server->nginx_is_modern;
}
$nginx_has_etag = drush_get_option('nginx_has_etag');
if (!$nginx_has_etag && $server->nginx_has_etag) {
$nginx_has_etag = $server->nginx_has_etag;
}
$nginx_has_http2 = drush_get_option('nginx_has_http2');
if (!$nginx_has_http2 && $server->nginx_has_http2) {
$nginx_has_http2 = $server->nginx_has_http2;
......@@ -650,7 +655,7 @@ location ^~ /<?php print $subdir; ?> {
location ~* ^/<?php print $subdir; ?>/(.*/files/advagg_(?:css|js).*) {
expires max;
access_log off;
<?php if ($nginx_is_modern): ?>
<?php if ($nginx_has_etag): ?>
etag off;
<?php else: ?>
add_header ETag "";
......
......@@ -24,6 +24,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
$this->configs['site'][] = 'Provision_Config_Nginx_Site';
$this->server->setProperty('nginx_config_mode', 'extended');
$this->server->setProperty('nginx_is_modern', FALSE);
$this->server->setProperty('nginx_has_etag', FALSE);
$this->server->setProperty('nginx_has_http2', FALSE);
$this->server->setProperty('nginx_has_gzip', FALSE);
$this->server->setProperty('nginx_has_upload_progress', FALSE);
......@@ -60,6 +61,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9|[1-9][0-9]+)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_etag = preg_match("/nginx\/1\.([12][0-9]|[3]\.([12][0-9]|[3-9]))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_http2 = preg_match("/http_v2_module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
......@@ -115,6 +117,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9|[1-9][0-9]+)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_etag = preg_match("/nginx\/1\.([12][0-9]|[3]\.([12][0-9]|[3-9]))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_http2 = preg_match("/http_v2_module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
......
......@@ -39,6 +39,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
$this->configs['site'][] = 'Provision_Config_Nginx_Ssl_Site';
$this->server->setProperty('nginx_config_mode', 'extended');
$this->server->setProperty('nginx_is_modern', FALSE);
$this->server->setProperty('nginx_has_etag', FALSE);
$this->server->setProperty('nginx_has_http2', FALSE);
$this->server->setProperty('nginx_has_gzip', FALSE);
$this->server->setProperty('nginx_has_upload_progress', FALSE);
......@@ -64,6 +65,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9|[1-9][0-9]+)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_etag = preg_match("/nginx\/1\.([12][0-9]|[3]\.([12][0-9]|[3-9]))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_http2 = preg_match("/http_v2_module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
......@@ -110,6 +112,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9|[1-9][0-9]+)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_etag = preg_match("/nginx\/1\.([12][0-9]|[3]\.([12][0-9]|[3-9]))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_http2 = preg_match("/http_v2_module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment