Reputation: 45
How can I configure NGINX to show Local time (CEST) in HTTP Date parameter instead of Universal Time (UTC)?
I have added
export TZ="Europe/Ljubljana"
to /etc/init.d/nginx and
env TZ="Europe/ljubljana";
to /etc/nginx/nginx.conf
Log file (/var/log/nginx/access.log) shows local time, but HTTP response shows universal time (curl --head http://mysite).
For the following time settings
Current default time zone: 'Europe/Ljubljana'
Local time is now: Mon Jun 26 11:23:24 CEST 2017.
Universal Time is now: Mon Jun 26 09:23:24 UTC 2017.
I would like to see HTTP header
Date: Mon, 26 Jun 2017 11:23:24 CEST
not
Date: Mon, 26 Jun 2017 09:23:24 GMT
Upvotes: 1
Views: 6781
Reputation: 2818
You can't affect this header with any configuration. It is standard requirement.
The Date general-header field represents the date and time at which the message was originated, having the same semantics as orig-date in RFC 822. The field value is an HTTP-date, as described in section 3.3.1; it MUST be sent in RFC 1123 [8]-date format.
https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
All HTTP date/time stamps MUST be represented in Greenwich Mean Time (GMT), without exception. For the purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal Time). This is indicated in the first two formats by the inclusion of "GMT" as the three-letter abbreviation for time zone, and MUST be assumed when reading the asctime format. HTTP-date is case sensitive and MUST NOT include additional LWS beyond that specifically included as SP in the grammar.
https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 and
Upvotes: 2