ubuntunginxubuntu-16.04ubuntu-server

Nginx shows wrong time/timezone


How to fix Nginx timezone? I've configured nginx to serve a directory but datetime of creation is one hour after my real time.

I've added to /etc/init.d/nginx

export TZ='Europe/Bratislava'

then

sudo service nginx reload
sudo service nginx restart

But it didn't help, there should be 14:19 instead of 13:19.

EDIT

Tried to change Ubuntu default timezone but the datetimes aren't changed.

sudo dpkg-reconfigure tzdata

enter image description here


Solution

  • By default, nginx outputs the directory index in UTC time. If you want it to display the time in your local timezone, you should set the autoindex_localtime directive to on.

    autoindex_localtime on