This happened with 3.4 as well, but now also in 3.5 after upgrading (using the Ubuntu repository)

We get this error in the log when trying to reload or restart nginx:

[warning]
nginx on manu.herkserver.com could not be restarted.
Changes might not be available until this has been done. (error: Reloading nginx configuration: nginx: [emerg]
unknown directive "etag" in
/var/aegir/config/includes/nginx_vhost_common.conf:78
nginx: configuration file /etc/nginx/nginx.conf test failed)

etag is used in the following two blocks in /var/aegir/config/includes/nginx_vhost_common.conf

location ^~ /cdn/farfuture/
location ~* files/advagg_(?:css|js)/

Commenting out the etag lines allows nginx to start.

We're using nginx version 1.2.1 on Debian 7.10 (Wheezy)

It looks like the etag directive was added in nginx 1.3.3
http://nginx.org/en/docs/http/ngx_http_core_module.html#etag

I'm unsure if we can upgrade to 1.3.3. on our current platform, but there seems no reason to have the etag directive there if it breaks an otherwise functional nginx configuration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

millenniumtree created an issue. See original summary.

millenniumtree’s picture

Issue summary: View changes
millenniumtree’s picture

Project: Aegir Hosting CiviCRM » Provision
Version: 7.x-3.5 » 7.x-3.6

Had this in the wrong Project.

memtkmcc’s picture

Assigned: Unassigned » memtkmcc

It seems that the problem here is that one occurrence of the etag directive (in the /cdn/farfuture/ location) is not enclosed within the if/else check.

It should look like this:

<?php if ($nginx_is_modern): ?>
    etag       off;
<?php else: ?>
    add_header ETag "";
<?php endif; ?>
memtkmcc’s picture

Version: 7.x-3.6 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
1.54 KB

Attached patch should fix this.

memtkmcc’s picture

Component: Code » HTTP Service
millenniumtree’s picture

Wrapping it with the if would theoretically fix it, except nginx_is_modern is TRUE for versions 1.1.8+, and etag is only supported in 1.3.3+

Every time I've run an aegir upgrade, I have had to comment out TWO instances of the etag (including the 2nd one that is already if'ed)

I think another property (nginx_has_etag) should be added to provision/http/Provision/Service/http/nginx.php for nginx 1.3.3+ and used in the vhost templates instead of nginx_is_modern.

millenniumtree’s picture

Here's a new regex that should match anything 1.3.3 or above.
nginx\/1\.([12][0-9]|[3]\.([12][0-9]|[3-9]))

memtkmcc’s picture

Hmm.. This gets a bit complicated, because we can't modify the regex for $nginx_is_modern since it is mainly related to limit_zone deprecated in Nginx 1.1.8, and replaced by limit_conn_zone.

I don't like the idea of introducing more versions checks and more properties to accommodate old Debian releases. After all, Jessie comes with Nginx 1.6.2 and is a current Debian stable for over a year (since April 26th, 2015).

Also, you can always get rid of all those config issues by disabling the "extended" config, if it breaks things for you. Just `touch /etc/nginx/basic_nginx.conf` and re-verify the server.

memtkmcc’s picture

Status: Needs review » Needs work

At any rate, my patch doesn't fix the problem here.

millenniumtree’s picture

So nginx 1.6.2 is supported...
$nginx_is_modern is there specifically to support nginx before 1.1.8...
But versions between 1.1.8 and 1.3.3 will fail due to the etag lines...
Because that makes little sense to me, I made this patch to fix it. :)

millenniumtree’s picture

Status: Needs work » Needs review
millenniumtree’s picture

One of the hunks failed on 7.x-3.6, but applies on the current git 7.x-3.x. Had to manually apply it in 3.6 (but that may have been from your previous patch being applied...)

Successfully tested on the following two platforms, both with provision 7.x-3.6:
Ubuntu 14.04.4 LTS with nginx 1.4.6
Debian 7.6 "wheezy" with nginx 1.2.1

memtkmcc’s picture

Assigned: memtkmcc » Unassigned
Status: Needs review » Reviewed & tested by the community

Looks good to me, thanks!

memtkmcc’s picture

helmo’s picture

Status: Reviewed & tested by the community » Needs work

The patch from #11 fails to apply to the current 7.x-3.x :(

millenniumtree’s picture

Status: Needs work » Needs review
FileSize
7.85 KB

Re-rolled patch for latest 3.x

helmo’s picture

Status: Needs review » Fixed

Committed, as it was rtbc already.

helmo’s picture

Hmm, commit notification is not showing up here ... but it's in... http://cgit.drupalcode.org/provision/commit/?id=fd9aca8

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.