www.digitaldaze.com
Changing the Time Zone

The default timezone on your server is set to be the same as the System Time. System time is the timezone that the operating system uses, in this case, GMT. You can change the timezone your server uses to be different from System Time by following these instructions.

  • Connect to your server via SSH or Telnet and complete these steps.

    1. Select the Timezone you want to use from the /usr/share/zoneinfo/ directory:

      % cd /usr/share/zoneinfo
      % ls
      		
    2. Copy the time zone file onto your Virtual Private Server. This example uses the America/Los_Angeles timezone:

      % cp /usr/share/zoneinfo/America/Los_Angeles ~/etc/localtime
      	    
    3. Create the following directory on your virtual server and copy the appropriate file:

      % mkdir ~/usr/share/zoneinfo
      % mkdir ~/usr/share/zoneinfo/America
      % cp /usr/share/zoneinfo/America/Los_Angeles ~/usr/share/zoneinfo/America/
                 
    4. Add the following new line to the ~/.cshrc file.

      setenv TZ America/Los_Angeles
                 

      After editing the ~/.cshrc file, be sure to run:

      % source ~/.cshrc
                 
    5. To configure cron to use the same timezone, add the following line to the beginning of your cronfile:

      TZ=America/Los_Angeles
                 
    6. Finally, restart Apache so that your web server will use your new timezone for it's log files.

      restart_apache
                 

Did It Work?
To make sure you set the time zone correctly, do the following:

% date
% virtual date
    

These should both show the timezone you set your server to use.

 

[Legal Notice]
http://www.digitaldaze.com