Friday, September 30, 2011

kloxo Assigning a Dedicated IP address to your Site

Other Useful Features

Kloxo has many other features that are very useful. Some of the more common and frequently used features are explained below and include assigning a site a dedicated IP address, setting up and SSL certificate, using the "Files" tab and a brief discussion of clients and resellers you can create on your VPS.
NOTE: Your VPS has one IP address assigned to it by default. This is the IP address referenced in your welcome e-mail. If your VPS plan includes more than one IP address you can request additional IP addresses through our ticket system: http://my.a2hosting.com
Please provide the reason for needing the additional IP address in your ticket. We keep documentation on all IP requests to prevent usage that is against our Terms of Service. If you have used all of your available IP you can request additional IP address through the ticket system. Current pricing is $3 per IP per month but is subject to change.

Assigning a Dedicated IP address to your Site

To assign a dedicated IP address to your site, log into Kloxo. From the Home screen click the "Ipaddresses" icon in the "Resources" box.

After clicking on the icon you will be taken to a screen that lists all IP addresses assigned to your VPS. Click on the IP address you wish to assign to a particular domain. You will then be taken to the options screen for that IP address.

Click the "Configure Domain" tab at the top of the page. You will then be presented with something like the following:

Use the drop-down menu to select the domain you wish to assign to the IP address listed in the box above then click "Update".
NOTE: If you have not yet updated DNS for your domain you will receive an error message like the following:
Alert: To map an IP to a domain, the domain must ping to the same IP, otherwise, the domain will stop working. The domain you are trying to map this IP to, doesn't resolve back to the IP, and so it cannot be set as the default domain for the IP.
If you would like to assign your site a dedicated IP BEFORE you update DNS you can do so by adding the following line to /etc/hosts
'192.168.1.1 domain.tld'
You can either edit the file directly or issue a command such as the following:
'echo "192.168.1.1 domain.tld" >> /etc/hosts'
(make sure you use two ">>" or you will overwrite the file.)
In both examples remove the single quotes around the outside and replace the '192.168.1.1' with the IP address you want to assign and "domain.tld" with your domain name.
After you have made this change you can go back and follow the steps for adding the dedicated IP address listed above and you should not receive the error. You cannot assign a dedicated IP address to more than one site. If you do not assign a site a dedicated IP address it will "share" the main IP address on the server by means of virtual hosts in your webserver software (apache/lighttpd). These will be configured automatically by Kloxo.

Installing an SSL Certificate

Through Kloxo you can install an SSL certificate you have already purchased, create a self- signed certificate for personal use or generate a "CSR" (certificate signing request) for ordering a new certificate.
NOTE: In order to install an SSL certificate on a domain it MUST have a dedicated IP address. Only one SSL certificate can be installed per IP address.
Log into Kloxo and go to the Home screen. In the "Resources" box click the SSL Certificates icon.

  1. Uploading a Current SSL Certificate
    1. If you already have an SSL certificate you would like to use click the "Add Upload File" tab. Give the SSL certificate a name; this can be anything you like. Click the "Browse" buttons and upload the Key, Certificate, and CA file (if applicable) then click "Add"
    2. Now click the "SSL Certificates" tab and you should see the SSL certificate you just uploaded in the list.
    3. Assign the domain you wish to configure a dedicated IP address (see instructions above)
    4. Click the "Home" tab then click the "Ipaddresses" icon in the 'Resources' box.
    5. Click the IP address you assigned to the domain you are installing the SSL certificate on then click the "SSL Configuration Home" tab.
    6. Using the drop-down menu select the name of the SSL certificate you uploaded previously then click "Update"
    7. Kloxo should restart Apache (or lighttpd) automatically but if https:// isn't working properly you may need to restart it manually.
  2. Generating a self-signed SSL certificate
    1. Log into Kloxo and go to the Home screen. In the "Resources" box click the SSL Certificates icon.
    2. Click the "Add SSL Certificate" tab
    3. Give the SSL certificate a name and fill in the appropriate information in the boxes. Please keep in mind that an ssl certificate for "www.domain.com" is different from just "domain.com" so be sure to specify version of your domain you want the SSL certificate on. Click the "Add" button once you have filled in the appropriate information.
    4. Assign the domain you wish to configure a dedicated IP address (see instructions above)
    5. Click the "Home" tab then click the "Ipaddresses" icon in the 'Resources' box.
    6. Click the IP address you assigned to the domain you are installing the SSL certificate on then click the "SSL Configuration Home" tab.
    7. Using the drop-down menu select the name of the SSL certificate you uploaded previously then click "Update"
    8. Kloxo should restart Apache (or lighttpd) automatically but if https:// isn't working properly you may need to restart it manually.
  3. Generating a CSR to order a new SSL certificate from a certificate authority
    1. You can purchase SSL certificates through A2 Hosting. To view current offerings please see http://www.a2hosting.com/services/ssl-hosting You can submit a ticket to our billing department to order an SSL certificate.
    2. If you just need a CSR for use with an outside provider, log into Kloxo and go to the Home screen. In the "Resources" box click the SSL Certificates icon.
    3. Click the "Add SSL Certificate" tab
    4. Give the SSL certificate a name and fill in the appropriate information in the boxes. Please keep in mind that an ssl certificate for "www.domain.com" is different from just "domain.com" so be sure to specify version of your domain you want the SSL certificate on. Click the "Add" button once you have filled in the appropriate information.
    5. Click on the "SSL Certificates" tab then click on the name of the SSL certificate you just created.
    6. The CSR will be listed in the middle of the screen. You can copy and paste the CSR (be sure to include the ----- BEGIN ----- and -----END----- lines) into your outside providers request form.

The "Files" Tab

You can use the "Files" tab as an alternative to FTP or SFTP to upload or download files to/from your site. You can also zip files or folders for smaller download, upload files from your home computer, a remote URL, or remote FTP server (the last 2 are great for transferring your data from your old hosting account).
The files tab does not require much explanation. Just click on the "Files" tab and use the File Manager tab to navigate your files then view/download current files or use the Upload tab to add files to your site. All uploaded files will be placed in "/home/admin"

Clients and Resellers

There are two types of clients; Resellers and customers. The main difference is Resellers can have customers under them. The smallest unit of authorization in Kloxo is a customer, who can have multiple domains under them.
In order to setup a Reseller or Client you will need to create a Resource Plan. A resource plan determines how many clients a reseller can have, how many domains can be hosted, traffic allowed, disk space allowed and much more.
If you are hosing multiple sites for different clients and wish to give them access to their content you can add a client login so they can modify their web content but no one else's.
The home directory of a customer is '/home/clientname', and his domain's document root is /home/clientname/domain.com'. He can also login through ftp using his clientname as the id and the password.

Tuesday, September 13, 2011

วิธีการใช้งาน date selector ด้วย PopCalendarXP เพื่อรองรับกับวันที่ MySQL


PopCalendarXP เป็นของฟรีอีกแล้วครับ ผมเอามาใช้กับโค้ด php ซึ่งเปลี่ยนให้เป็นภาษาไทยเรียบร้อยแล้ว เหลือแต่ปีที่ยังเป็นคริสศักราช อยู่ ทำเป็นปีไทยไม่เป็นแต่ก็พอใช้งานได้ครับ ใครสนใจรายละเอียดเพิ่มเติมก็เวปนี้เลย www.calendarxp.net/

วิธีใช้น่ะครับ
  • unzip ไฟล์ออกมาแล้วไปวางในเวปpath ของ server เช่น ของผมวางไว้ที่
    C:\AppServ\www\date1\

  • ใน โฟลเดอร์ date1 ผมจะสร้างไว้ สองไฟล์ไว้ test น่ะครับคือ date01.php และ date02.php ซึ่งสองไฟล์นี้ก็ใช้ dreamweaver สร้างมาครับง่ายดีและจะมีโฟลเดอร์ PopCalendarXP ซึ่งเป็นไฟล์ที่ผมโหลดมาและแก้เป็นภาษาไทยเรียบร้อยแล้ว
  • ลองรันตามนี้น่ะครับ http://localhost/date1/date01.php
  • ซึ่งวิธีการ install ผมขอสรุปคร่าวๆดังนี้น่ะครับ
  1. สร้าง form ขึ้นมาและสมมุติตั้งชื่อ form เป็น testform
  2. สร้าง text field ขึ้นมาและสมมุติตั้งชื่อว่า dc
  3. ให้นำโค้ดนี้วางไว้หลังคำสั่ง text field
    <a href="javascript:void(0)" onclick="if(self.gfPop)gfPop.fPopCalendar(document.testform.dc);return false;" ><img class="PopcalTrigger" align="absmiddle" src="PopCalendarXP/calbtn.gif" width="34" height="22" border="0" alt=""></a> 
    
    

  4. สังเกตในโค้ดตรง (document.testform.dc) จะเห็นว่า form_name.textfield_name จะต้องเหมือนกันกับที่เราตั้งไว้น่ะครับซึ่งหากเราต้องการใช้งาน selector หลายตัวใน form เดียวกันเราก็แค่เปลี่ยนเฉพาะชื่อ text field ให้ต่างกันก็พอครับซึ่งในโค้ด date01.php ผมจะใช้เป็น (document.testform.dc)และ (document.testform.dc1)เพื่อใช้ตัว selector สองตัว
  5. ลืมขั้นตอนสุดท้ายก็ต้องเอาโค้ดข้างล่างนี้น่ะครับไปวางไว้ก่อนtag </body> นะครับ
    <!--  PopCalendar(tag name and id must match) Tags should not be enclosed in tags other than the html body tag. -->
    <iframe width=174 height=189 name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="PopCalendarXP/ipopeng.htm" scrolling="no" frameborder="0" style="visibility:visible; z-index:999; position:absolute; top:-500px; left:-500px;">
    </iframe>
    

ซึ่งเท่านี้เราก็จะได้การส่งค่าวันที่ไปเก็บลงในฐานข้อมูลแบบdefault ของMySQL เรียบร้อยครับ
โหลดโค้ดทั้งหมดได้ที่นี่ครับ date1.zip

Fusionchart+PHP+MySQL แบบทีละ Step คับ

วิธีการแสดงกราฟ Fusionchart v.3 โดยดึงข้อมูลมาจากฐานข้อมูล MySQL โดยใช้ภาษา PHP ครับ

step1. เริ่มจากสร้างฐานข้อมูลที่ชื่อ fusion-test [Download] และสร้างตารางที่ชื่อ data1 และเพิ่มข้อมูลลงไปตามรูปครับ


step2. โหลดกราฟ [download] และ unzip ไว้ในเวป root โดยของผมจะเก็บไว้ที่นี่ C:\AppServ\www\FusionCharts_Evaluation\ จากนั้นก็ลองเรียกดูเลยครับตาม path นี้
http://localhost/FusionCharts_Evaluation/Code/PHP/DBExample/Default.php
ถ้ารันได้แบบนี้ก็โอเคแล้วครับ


หมาย เหตุ กราฟที่ผมให้โหลดเป็นตัวที่ผมตัดบางส่วนออกเอาเฉพาะไฟล์ที่เกี่ยวข้องเท่า นั้นและแก้ไขเรียบร้อยแล้วน่ะครับโดยใครอยากโหลดเอาไฟล์ทั้งหมดทุกภาษา สามารถโหลดได้ที่เวปนี้ www.fusioncharts.com

โดยกราฟที่ผมต้องการแสดงคือ แสดงจำนวนที่เหลือของสินค้าแต่ละประเภท
ไฟล์ที่ผมแก้ไขมีตามนี้ครับ
1.ไปที่ C:\AppServ\www\FusionCharts_Evaluation\Code\PHP\Includes แก้ไฟล์ DBConn.php ตามนี้
$hostdb = 'localhost';   // MySQl host
    $userdb = 'root';    // MySQL username
    $passdb = 'Your-Password';    // MySQL password ถ้าไม่มีก็ใส่ ''
    $namedb = 'fusion-test'; // MySQL database name


2.ไปที่ C:\AppServ\www\FusionCharts_Evaluation\Code\PHP\DBExample แก้ไฟล์ Default.php ตามนี้
$strQuery = "select distinct(type) as type_name , sum(amount) as count_amt from data1 group by type_name";

            $strXML .= "<set label='" . $ors2['type_name'] . "' value='" . $ors2['count_amt'] . "' />";


และหากต้องการเปลี่ยนกราฟแท่งก็แค่แก้ตรงคำสั่ง เปลี่ยนจาก Pie3D.swf เป็น Column3D.swf ตามนี้
echo renderChart("../../FusionCharts/Column3D.swf", "", $strXML, "FactorySum", 600, 300, false, false);



ที่ต้องแก้หลักๆก็มีแค่นี้ครับ คือ query คำสั่งใหม่ แล้วก็ set ค่า label เพื่อส่งค่า xml ให้ตรงกับ query ไปยังตัวกราฟ
เสร็จแล้วค๊าบ ง่ายป่าว อิอิ

Kloxo error "Some of Horde's configuration files are missing or unreadable conf.php"

Kloxo error "Some of Horde's configuration files are missing or unreadable conf.php"

วันนี้ติดตั้ง kloxo ใหม่ ปรากฏว่า webmail ทั้ง Horde และ RoundCube ใช้ไม่ได้ ขึ้น error ทั้งคู่

Error ของ Horde
"Some of Horde's configuration files are missing or unreadable conf.php"

ลองค้นหาวิธีแก้ไขใน LxCenter พบทางแก้ที่ได้ผลคือใช้คำสั่ง

chmod 644 /home/kloxo/httpd/webmail/horde/config/conf.php

ปัญหาคือไฟล์ conf.php ได้เปลี่ยน Permission เป็น 600 ทำให้ใช้งานไม่ได้

Error ของ RoundCube
Roundcube had "Configuration Error: db.inc.php"

ปัญหาเกิดขึ้นอย่างเดียวกันคือ Permission ของ db.inc.php เป็น 600
ทางแก้ก็ใช้ putty เข้าไปใช้คำสั่ง

chmod 644 /home/kloxo/httpd/webmail/roundcube/config/db.inc.php

วิธีติดตั้ง MTRG บน Kloxo

เป็นหนึ่งในเทคนิคที่ผมนำมาเพิ่มความสามารถให้แก่ VPS(Linux) ที่ใช้ Control Panel Kloxo Lxadmin
ซึ่ง ถ้า VPS ที่เราเช่ามาเป็นแบบไม่มี Control Panel สำหรับดู Status ต่างๆของ VPS  มันก็เป็นเรื่องลำบากพอสมควร ที่เราจะเช็คว่า VPS หรือ Server ของเรา ใช้งาน CPU, RAM, Traffic , Connections ไปมากน้อยแค่ไหน

จริงแล้วๆ มีโปรแกรมอื่นๆที่นิยมใช้กันอีกนอกจาก MRTG อย่าง Munin ก็แสดงผลได้ละเอียดดีเหมือนกัน

ก่อนอื่นก็เข้า Shell ก่อนนะครับ แล้วก๊อบคำสั่งไปใช้งานได้เลยครับ

- ติดตั้ง mrtg ก่อน
yum -y install net-snmp net-snmp-utils mrtg
cd /etc/snmp/
mv snmpd.conf snmpd.conf.bak
nano snmpd.conf


- แก้ไข Config โดยการก๊อบข้างล่างไปวางใน text editor เลยครับ
syslocation  Thailand
syscontact  admin
sysservices 79
rocommunity  snmp 127.0.0.1
agentaddress  127.0.0.1


chkconfig snmpd on
/etc/init.d/snmpd start


- สร้าง Directory ที่ใช้ในการทำงานของ mrtg
mkdir -p /home/kloxo/httpd/default/mrtg
cd /etc/mrtg/


- แก้ไข Config ของ mrtg
mv mrtg.cfg mrtg.cfg.bak
nano mrtg.cfg


- คำโค้ดไฟล์การตั้งค่าไปใส่ใน text editor
LoadMIBs: /usr/share/snmp/mibs/UCD-SNMP-MIB.txt,/usr/share/snmp/mibs/TCP-MIB.txt,/usr/share/snmp/mibs/UDP-MIB.txt
WorkDir: /home/kloxo/httpd/default/mrtg
Options[_]: growright
EnableIPv6: no
Target[server.traffic]: 2:snmp@127.0.0.1:::::2
SetEnv[server.traffic]: MRTG_INT_IP="eth0" MRTG_INT_DESCR="eth0"
MaxBytes[server.traffic]: 125000000
Title[server.traffic]: Traffic Load
PageTop[server.traffic]: <h1>Traffic Load</h1>
Options[server.traffic]: growright, bits

#
# Memory Monitoring (Free with Buffer,/Cache/Total)
#
Target[server.memory]: memTotalSwap.0&memAvailReal.0:snmp@127.0.0.1 + PseudoZero&memBuffer.0:snmp@127.0.0.1 - memAvailSwap.0&PseudoZero:snmp@127.0.0.1
Title[server.memory]: Free Memory
PageTop[server.memory]: <H1>Free Memory</H1>
MaxBytes[server.memory]: 1044480000
ShortLegend[server.memory]: KBytes
YLegend[server.memory]: KBytes
LegendI[server.memory]: Swap inused
LegendO[server.memory]: Free Memory
Legend1[server.memory]: Swap inused
Legend2[server.memory]: Free memory inc Buffer
Options[server.memory]: growright,gauge,nopercent
#kMG[server.memory]: k,M,G

#
# CPU Monitoring
# (Scaled so that the sum of all three values doesn't exceed 100)
#
 
Target[server.cpu]: ssCpuRawUser.0&ssCpuUser.0:snmp@127.0.0.1 + ssCpuRawSystem.0&ssCpuSystem.0:snmp@127.0.0.1
Title[server.cpu]: Server CPU Load
PageTop[server.cpu]: <H1>CPU Utilization</H1>
MaxBytes[server.cpu]: 100
ShortLegend[server.cpu]: %
YLegend[server.cpu]: % CPU#Legend1[server.cpu]: Current CPU Idle
Legend1[server.cpu]: Accurate CPU Load
Legend2[server.cpu]: Current CPU Load
#LegendI[server.cpu]: Percentage CPU Idle
LegendI[server.cpu]: Accurate CPU Load
LegendO[server.cpu]: Current CPU Load
Options[server.cpu]: growright,nopercent,gaugeUnscaled[server.cpu]: ymwd
 #
# Load Average 1 & 15 min
# (Scaled so that the sum of all three values doesn't exceed 100)
#
Target[server.load]: laLoadInt.3&laLoadInt.1:snmp@127.0.0.1
Title[server.load]: Load Average at 15 and 1 Min
PageTop[server.load]: <H1>Load Average</H1>
MaxBytes[server.load]: 10000
ShortLegend[server.load]: #
YLegend[server.load]: #Load
Legend1[server.load]: Current CPU load (15 Mins)
Legend2[server.load]: Current CPU load (1 Mins)
LegendI[server.load]: Load 15 Mins
LegendO[server.load]: Load 1 Mins
Options[server.load]: growright,nopercent,gauge

#
# New TCP Connection Monitoring (per minute)
#
 
Target[server.newconns]: tcpPassiveOpens.0&tcpActiveOpens.0:snmp@127.0.0.1
Title[server.newconns]: Newly Created TCP Connections
PageTop[server.newconns]: <H1>New TCP Connections</H1>
MaxBytes[server.newconns]: 65536
ShortLegend[server.newconns]: c/sYLegend[server.newconns]: Conns / Min
LegendI[server.newconns]: In
LegendO[server.newconns]: Out
Legend1[server.newconns]: New inbound connectionsLegend2[server.newconns]: New outbound connectionsOptions[server.newconns]: growright,nopercent,perminute#Unscaled[server.newconns]: ymwd
#kMG[server.newconns]: k,M,G,T,P,X  
 #
# Established TCP Connections
#
 Target[server.estabcons]: tcpCurrEstab.0&tcpCurrEstab.0:snmp@127.0.0.1
Title[server.estabcons]: Currently Established TCP Connections
PageTop[server.estabcons]: <H1>Established TCP Connections</H1>
MaxBytes[server.estabcons]: 65536
ShortLegend[server.estabcons]: #
YLegend[server.estabcons]: Connections
LegendI[server.estabcons]: In/Out
LegendO[server.estabcons]: Legend1[server.estabcons]: Established connectionsLegend2[server.estabcons]: Options[server.estabcons]: growright,nopercent,gauge


- สุดท้าย
indexmaker --columns=2 --output=/home/kloxo/httpd/default/mrtg/index.html /etc/mrtg/mrtg.cfg


การเรียกใช้งาน เรียกผ่าน ip server/vps ของคุณ http://xxx.xxx.xxx.xxx/mrtg

Posted Image


หวังว่าคงเป็นประโยชน์ครับ

ปัญหากราฟ apache ไม่แสดงรูป

ตอนนี้ติดปัญหากราฟ apache ไม่แสดงรูปเลยอ่ะค่ะ

ค่า /etc/httpd/conf/httpd.conf ก็ไปทำมาแล้ว

อ้างถึง
LoadModule status_module modules/mod_status.so


อ้างถึง
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
#
<Location /server-status>
    SetHandler server-status
#    Order deny,allow
#    Deny from all
    Allow from all
</Location>


อ้างถึง
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
ExtendedStatus On

Magic Quotes GPC ใน kloxo คือ

คุณเคยสงสัยหรือไม่ว่า  Magic Quotes GPC  คืออะไร? แก้ไขตรงไหน? จำเป็นหรือไม่?
Magic Quotes GPC มีไว้เผื่อช่วยให้เราสามารถนำข้อมูล หลังจากที่เรา submit form ไป query ใส่ database ได้โดยไม่ error

ซึ่งการรับข้อมูลจาก form ต่างๆ  มีโอกาสที่ user จะกรอก Single quote (') หรือ Double quote (") เข้ามาในช่อง input box ของเราได้
ดังนั้นถ้าเรานำข้อมูลไปใช้โดยตรงทำให้มีโอกาส  query error ได้
ถ้าหาก   Magic Quotes GPC = On
จะมีการเติม \ เข้าไปที่หน้า Single quote หรือ Double quote ให้อัตโนมัต  ทำให้สามารถนำค่าไป query ได้ทันที
ดังนั้นการ query เราจึงต้องเช็คดังนี้
01if (get_magic_quotes_gpc()) {
02    $name = stripslashes($_POST['name']);
03}
04else {
05    $name= $_POST['name'];
06}
07 
08$name= mysql_real_escape_string($name);
09 
10$sql = "INSERT INTO table_name (name) VALUES ('$name')";
แต่ถ้าหากนำไปแสดงผลในส่วนที่ชนกับ Single quote หรือ Double quote ของ syntax บน html ล่ะ?
1// สมมุติให้  user กรอกค่าเข้ามาเป็น  "your name"
2// ดังนั้นถ้าหากเราจะแสดงค่า your name ที่ value จะเป็นดังนี้
3<input name="name">

แน่นอนว่าการแสดงผลเช่นนี้ผิด syntax ของ html ดังนั้นเราจึงอาจใช้  function  htmlspecialchars  ของ php มาช่วยก่อนที่จะแสดงผลบนค่าของ value จะทำให้สามารถแสดงผลออกมาได้ถูกต้อง

การแก้ไข Magic Quotes GPC

สามารถแก้ไข Magic Quotes GPC ได้ที่ file php.ini
1# php.ini seting to trun On/Off
2magic_quotes_gpc = On

หรือสามารถแก้ที่ file .htaccess ได้ดังนี้
1# .htaccess seting to trun On/Off
2php_flag magic_quotes_gpc off

ดังนั้นการ set magic_quotes_gpc จะจำเป็นหรือไม่ขึ้นอยู่กับ code ของเราเองว่าได้ครอบ mysql_real_escape_string ไว้หรือไม่เพื่อลองรับข้อมูลจาก user ที่กรอก Single quote หรือ Double quote เข้ามา

[แก้]web mail ของ kloxo ไม่เชื่อมต่อ DB

[แก้]web mail ของ kloxo ไม่เชื่อมต่อ DB

สั่งใน shell
# sh /script/fixmail
# sh /script/fixwebmail
# service kloxo restart

จะติดตั้ง kloxo แนะนำให้สั่งตามนี้ก่อนครับ

จะติดตั้ง kloxo แนะนำให้สั่งตามนี้ก่อนครับ



ผมลองมาแล้วเวลาติดตั้ง kloxo จะเร็วกว่าตอนยังไม่สั่งครับ

   
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
# yum update -y
# yum groupinstall 'Development Tools' -y
# yum groupinstall 'Development Libraries' -y
# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
# cd /tmp
# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
# yum install ntp httpd mysql-server php php-mysql php-mbstring php-mcrypt phpmyadmin rpm-build gcc mysql-devel openssl-devel cyrus-sasl-devel pkgconfig zlib-devel pcre-devel openldap-devel postgresql-devel expect libtool-ltdl-devel openldap-servers libtool gdbm-devel pam-devel gamin-devel -y
# yum install amavisd-new spamassassin clamav clamd unzip bzip2 unrar perl-DBD-mysql -y
# cd /etc/yum.repos.d/
# wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
# yum --enablerepo=kbs-CentOS-Testing install install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-mbstring php-mcrypt php-mhash php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli httpd-devel -y
# setenforce 0
# cd /root
# yum install -y wget
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-install-master.sh
# sh ./kloxo-install-master.sh --db-rootpassword=
# reboot

ใช้ kloxo ลง WordPress ติดตั้ง plugin, theme แล้วไม่ auto ไปหน้า Active

จากหัวข้อก็พอจะนึกภาพออกแล้วใช่มั้ยครับผมก็ไม่รู้มาตั้งแต่แรกครับว่ามัน เป็นเพราะอะไรครับแต่เมื่อกี่ได้ทำเจอกับปัญหาของ pure-ftpd ที่ติดมากับ kloxo มันใช้ไม่ได้ซะงั้นไม่เคยใช้ด้วยสิ่ เคยใช้แต่ Vsftpd ไม่มีอะไรมากเลยครับผมเลยจัดการลบ pure-ftpd และติดตั้ง Vsftpd แทนครับ เป็นที่น่าพอใจมาก ftp ใช้งานได้ปกติดีครับ แถมเวลาเราติดตั้ง plugin หรือ theme ของ wordpres ก็ยังติดตั้งเสร็จสมบูรณกว่าเดิมครับคือเมื่อมันอัพโหลดเสร็จมันก็จะ auto ไปหน้า Active โปรแกรมเลยแต่เมื่อก่อนค้าง อยู่ที่หน้า unpack … มาดูวิีธีการติดตั้ง Vsftpd แทน pure-ftpd กันครับ

1
2
3
4
5
6
7
8
9
# yum remove pure-ftpd -y
# yum install vsftpd -y
# cd /etc/vsftpd/
# mv vsftpd.conf vsftpd.conf_bak
# wget http://mirror.pishit.com/etc/vsftpd.conf
# touch chroot_list
# chmod 777 chroot_list
# setenforce 0
# chkconfig vsftpd on
จากนั้นสั่ง reboot ครับ
ปล. เมื่อทำการติดตั้ง Vsftpd ระบบของ kloxo อาจไม่สามารถสร้าง FTP user เพิ่มได้นะครับ ตรงนี้ก่อนจะติดตั้ง Vsftpd ให้คิดอย่างรอบคอบก่อนครับว่าควรทำตามผมหรือไม่ครับ

วิธีทำ Firewall ป้องกัน Server ที่ใช้ CP ของ Kloxo

Kloxo
Kloxo
วิธีนี้เอามาจากเว็บ lxcenter.org นะครับ แต่เห็นเป็นภาษาอังกษฤครับเลยอยากให้มีไทยบ้างครับหลักการของเค้าก็คือใช้ ปิด IPTABLES ไว้ก่อนครับแล้วทำ firewall rules ขึ้นมาใหม่ครับแล้วทำให้ firewall run ตอน boot ทุกครั้งครับโดยสร้าง script ไว้ที่ /etc/init.d/ ครับ เหมือน service ตัวหนึ่งเลยละครับทำง่ายมากๆ ครับที่อธิบายผมก็พอเข้าใจแบบนี้ครับ เทพที่ผ่านมาเจออย่าว่ากันนะครับ หุๆ มาดูวิธีกันเลยครับ

อย่างแรกสั่ง
ปิด service IPTABLES:
# /etc/init.d/iptables stop
กำหนดให้ service ไม่ต้อง run ตอน boot (เดี่ยวจะมีการสั่งเองในตัว script):
# chkconfig iptables off
จากนั้นท่านจะใช้คำสั่ง touch หรือ vi, vim อะไรก็ได้ครับสร้างไฟล์ชื่อ firewall ที่ตำแหน่ง /etc/init.d/ ครับมาดูที่ผมทำครับ
# vim /etc/init.d/firewall
โปรแกรม Vim มันจะสร้างไฟล์ให้เราเลยครับเพียงแค่กดปุ่ม i เพื่อเขียนข้อความลงไปครับแต่ไม่ต้องเขียนนะครับให้ท่าน Copy Script ด้านล่างนี้ลงไปวางเลยครับเพราะทางทีมงานของ Lxcenter เค้าจัดให้แล้วครับตามนี้เลย
Copy เิอาไปวางในไฟล์ /etc/init.d/firewall จากนั้นก็กด Esc 1 ครั้งที่แป้นพิมกด : และพิม wq และ Enter เพื่อบันทึกครับ
จาดนั้นก็มาสั่งอีกนิดครับทำให้ firewall script มันทำงานได้ก่อนครับโดยสั่ง
# chmod 700 /etc/init.d/firewall
และเพิ่ม Service firewall ของเราเมื่อกี่ครับ … ยังไงว่ะ งง … ดูด้านล่างครับ
# chkconfig –level 2345 firewall on
และสั่ง Start
# /etc/init.d/firewall start
ถ้าเห็นสถานะบอกว่า OK เยอะก็ใช้ได้แล้วครับง่ายๆ ครับแต่จะธิบายเรื่อง script นิดหนึ่งครับคือ เค้ากำหนดให้ปิด port ทุก port ก่อนแล้วมาเปิด port ที่จำเป็นสำหรับ CP Kloxo ครับแค่นั้นครับ
Write By Mr.Pishit


Thursday, September 8, 2011

Kloxo Installation Guide : คู่มือการติดตั้ง Kloxo นะตัวเธอ


หลังจากที่หลวมตัวไปเช่า VPS ของ PhotonVPS มาแล้ว ในแพ็คเกจ warp 2 สั่ง DirectAdmin ไปด้วย แต่ไม่ใช้ กร๊ากๆๆ เสียเงินทิ้ง เพราะอยากลองของฟรีดูบ้าง จริงๆ ไม่น่าสั่งตั้งแต่ตอนแรกแล้วล่ะ แล้วก็ไปหลงทาง เสียเวลากับ Webmin ไปนิดหน่อย พบกว่าไม่ใช่แนวทางที่ตัวเองชอบ กร๊ากๆๆ เลยเปลี่ยนแนวมาลองเล่น Kloxo ดูบ้าง พอดีมีเทรนเนอร์ด้วย จะได้ไม่ต้องถามใครอื่นไกล เอิ๊กๆ
เริ่มกันเลยดีกว่า
มาเช็คสเป็ค VPS หรือ Dedicated ของคุณก่อน ว่าใช้งานได้หรือไม่
1.  ต้องเป็น CentOS หรือ Red Hat EL (versions 5.1+) เท่านั้นนะ สำคัญ 32 Bit ด้วย
2.  ต้องมีแรมอย่างน้อย 256 MB (หลังจากติดตั้ง Kloxo แล้ว จะใช้แรมนิดหน่อย ประมาณ 33 MB เท่านั้น!!)
3.  ต้องมีพื้นที่ว่างอย่างน้อย 2 GB สำหรับ Service ต่างๆ ด้วย
ก่อนที่จะ Install ก็ต้องมา disable SELinux กันก่อนเลย โดยใช้ command ดังนี้
su - root
setenforce 0
หลังจากนั้นก็มาถึงขั้นตอนสำหรับ Install กันแล้วครับ
Command ตัวนี้ สำหรับคนที่ยังไม่ได้ติดตั้ง MySQL server
su - root
yum install -y wget
wget http://download.lxcenter.org/download/kloxo/production/kloxo-install-master.sh
sh ./kloxo-install-master.sh
Command ตัวนี้สำหรับคนที่มี MySQL server แล้วอย่างผมที่ตอนใช้ Webmin เมื่อครั้งก่อน อิอิ
su - root
yum install -y wget
wget http://download.lxcenter.org/download/kloxo/production/kloxo-install-master.sh
sh ./kloxo-install-master.sh --db-rootpassword=พาสเวิร์ดสำหรับ root ของแต่ละคนนั้นแหละครับ
ก็ใช้เวลาติดตั้งนิดหน่อยครับ แล้วก็จะขึ้นข้อความ Congratuations นั้นก็หมายความว่าเสร็จเรียบร้อยแล้วครับ
เวลาจะล็อกอิน ก็ไปที่ http://YOUR_SERVER_IP:7778 หรือ https://YOUR_SERVER_IP:7777
User + Password ก็ admin ทั้งคู่แหละครับ
เสร็จแล้วครับ สำหรับขั้นตอนการติดตั้ง Kloxo ง่ายมั๊ยครับ อิอิ

 
Design by Laikeng | Bloggerized by Storesu - sutoday | Court