UBUNTU

หากท่านที่ใช้ Apache2 แล้วหากมีการสั่ง restart แล้วปรากฏข้อความนี้

Starting httpd: httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


ซึ่งวิธีการแก้ปัญหาทำได้ดังนี้

echo HOST.DOMAIN.com > /etc/hostname


ความหมายของ การตั้ง domain
HOST = Your host name
DOMAIN = Your Domain Name

และกำหนดให้รับรู้ Domainใหม่ด้วยคำสั่ง


/bin/hostname -F /etc/hostname

และ สั่งให้ระบบ apache ทำงานใหม่

/etc/init.d/httpd restart

จบแล้วครับ
ที่มา http://www.wallpaperama.com/forums/how-to-fix-could-not-determine-the-servers-fully-qualified-domain-name-t23.html
ในบางครั้งที่มีการติดตั้ง Server ด้วย linux แล้ว หากเราเลือก timezone ของระบบผิด จะทำให้ระบบแสดงเวลาไม่ถูกต้อง และมีผลต่อ web ที่ต้องนำข้อมูลวันที่มาแสดง
เราจะมาดูวิธีการกำหนดกันนะครับ
สำหรับ Ubuntu สามารถใช้ เครื่องมือที่มีอยู่ด้วยคำสั่งนี้ครับ
tzconfig
เมื่อพิมพ์แล้วจะแสดงข้อมูลต่อไปนี้
Your current time zone is set to Asia/Bangkok <---- ตรงนี้หากเป็น zone อื่นจะแสดง
Do you want to change that? [n]: y

Please enter the number of the geographic area in which you live:


1) Africa 7) Australia

2) America 8) Europe

3) US time zones 9) Indian Ocean

4) Canada time zones 10) Pacific Ocean

5) Asia 11) Use System V style time zones

6) Atlantic Ocean 12) None of the above


Then you will be shown a list of cities which represent the time zone
in which they are located. You should choose a city in your time zone.

Number: 5

Aden Almaty Amman Anadyr Aqtau Aqtobe Ashgabat Ashkhabad Baghdad Bahrain
Baku Bangkok Beirut Bishkek Brunei Calcutta Choibalsan Chongqing Chungking
Colombo Dacca Damascus Dhaka Dili Dubai Dushanbe Gaza Harbin Hong_Kong
Hovd Irkutsk Istanbul Jakarta Jayapura Jerusalem Kabul Kamchatka Karachi
Kashgar Katmandu Krasnoyarsk Kuala_Lumpur Kuching Kuwait Macao Macau
Magadan Makassar Manila Muscat Nicosia Novosibirsk Omsk Oral Phnom_Penh
Pontianak Pyongyang Qatar Qyzylorda Rangoon Riyadh Riyadh87 Riyadh88
Riyadh89 Saigon Sakhalin Samarkand Seoul Shanghai Singapore Taipei
Tashkent Tbilisi Tehran Tel_Aviv Thimbu Thimphu Tokyo Ujung_Pandang
Ulaanbaatar Ulan_Bator Urumqi Vientiane Vladivostok Yakutsk Yekaterinburg
Yerevan

Please enter the name of one of these cities or zones
You just need to type enough letters to resolve ambiguities
Press Enter to view all of them again
Name: [] Bangkok
Your default time zone is set to 'Asia/Bangkok'.
Local time is now: Fri May 11 10:55:17 ICT 2007.
Universal Time is now: Fri May 11 03:55:17 UTC 2007.

ทำตามขั้นตอนเหล่านี้ก็จะเปลี่ยน Timezone ได้แล้วครับ
และมีอีกวิธีหนึ่งครับ อันนี้เขาบอกว่าใช้กับ Linux ทั่วไป อย่างไรก็ทดลองดูกันนะครับ
ขั้นตอนมีดังนี้ครับ
  1. Logged in as root, check which timezone your machine is currently using by executing `date`. You'll see something like "Mon 17 Jan 2005 12:15:08 PM PST -0.461203 seconds", PST in this case is the current timezone.
  2. Change to the directory to /usr/share/zoneinfo, here you will find a list of time zone regions. Choose the most appropriate region, if you live in Canada or the US this directory is the "Americas" directory.
  3. If you wish, backup the previous timezone configuration by copying it to a different location. Such as `mv /etc/localtime /etc/localtime-old`. <-- เริ่มที่ตรงนี้เลย
  4. Create a symbolic link fr om the appropiate timezone to /etc/localtime. Example: `ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime`.
    ของไทยก็ ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
  5. If you have the utility rdate, update the current system time by executing `/usr/bin/rdate -s time.nist.gov`.
  6. Set the ZONE entry in the file /etc/sysconfig/clock file (e.g. "America/Los_Angeles")
  7. Set the hardware clock by executing: ` /sbin/hwclock --systohc`
แค่นี้ก็จะเปลี่ยน timezone ได้แล้ว และเขาบอกว่าวิธีนี้สามารถใช้กับ RedHat Linux, Slackware, Gentoo, SuSE, Debian, Ubuntu ครับ
และนี้เป็นส่วนต่อท้ายที่บอกว่าอะไรทำได้แบบใดครับ

Tips

  • On some versions of RedHat Linux, Slackware, Gentoo, SuSE, Debian, Ubuntu, and anything else that is "normal", the command to display and change the time is 'date', not 'clock'
  • On RedHat Linux there is a utility called "Setup" that allows one to select the timezone from a list, but you must have installed the 'redhat-config-date' package.


Warnings

  • Some applications (such as PHP) have separate timezone settings from the system timezone.
  • On some systems, there is a system utility provided that will prompt for the correct timezone and make the proper changes to the system configuration. For example, Debian provides the "tzsetup" ot "tzconfig" utility.
ที่มาครับ http://www.wikihow.com/Change-the-Timezone-in-Linux
ขอให้สนุกกับ Linux


สำหรับผมเคยใช้ Fedoracore มาจะคุ้นเคยกับที่เก็บ ข้อมูลของ webpage /var/www/html
แต่พอมาใช้ UBUNTU ตำแหน่งที่เก็บ จะมีแค่ /var/www เท่านั้น ดังนั้น
หากต้องการทำให้เป็นแบบเดียวกับ ของ Fedoracore ก็สามารถทำได้ดังนี้ครับ
ไปที่
cd /etc/apache2/sites-available

หรือ
nanao /etc/apache2/sites-available/default

ก็จะปรากฏ รายละเอียดดังนี้
NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # Uncomment this directive is you want to see apache2's
                # default start page (in /apache2-default) when you go to /
                #RedirectMatch ^/$ /apache2-default/
        #add these 3
        AddHandler mod_python .py
        PythonHandler mod_python.publisher
        PythonDebug On
        #/add these 3
        </Directory>
.
..........

เราก็แก้ไขให้เป็นดังนี้
NameVirtualHost *
<VirtualHost *>
        ServerAdmin webmaster@localhost

DocumentRoot /var/www/html
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                # Uncomment this directive is you want to see apache2's
                # default start page (in /apache2-default) when you go to /
                #RedirectMatch ^/$ /apache2-default/
        #add these 3
        AddHandler mod_python .py
        PythonHandler mod_python.publisher
        PythonDebug On
        #/add these 3
        </Directory>
 
จากนั้น ก็สร้าง directory ใหม่ด้วย
mkdir -p /var/www/html

แล้วก็สั่งให้ restart apache ใหม่
/etc/init.d/apache2 restart

เท่านี้ก็เรียบร้อยครับ ทดลองดูแล้วกันนะครับ

edit @ 2007/05/10 18:57:43
edit @ 2007/05/10 18:59:09