http://www.ssl.in.th/index.php/main/public/action/view/page/Generate_CSR
อันนี้เป็นวิธีการสร้างไฟล์ CSR สำหรับผู้ทีใช้ openssl ในการสร้าง CSR
https://knowledge.geotrust.com/support/knowledge-base/index?page=content&id=AR876
http://www.ssl.in.th/index.php/main/public/action/view/page/Generate_CSR
อันนี้เป็นวิธีการสร้างไฟล์ CSR สำหรับผู้ทีใช้ openssl ในการสร้าง CSR
https://knowledge.geotrust.com/support/knowledge-base/index?page=content&id=AR876
ในไฟล์ XX-ds.xml ที่ deploy ลงใน <server_instance_name>/deploy/…
ระหว่างที่ database แรก ล่มแล้วย้ายไปสร้าง connection กับ database ตัวที่สอง จะมีการล่มเกิดขึ้น ดังนั้นก่อนที่ application จะได้ connection ไปจึงต้องมีการ check ก่อนว่า connection นั้นใช้ได้หรือไม่ ด้วย tag
<valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
**อ้างอิง http://jagadesh4java.blogspot.com/2011/09/jboss-database-failover-high.html
เป็นตัวอย่าง code การแปลงจากไฟล์ที่มีภาษาไทย เข้ารหัสด้วย UTF-8 (ภาษาไทยแต่ละตัวใช้พื้นที่ 3 bytes)
—-> แปลงเป็นไฟล์ที่มีภาษาไทย เข้ารหัสด้วย TIS620 โดยภาษาไทยแต่ละตัวใช้พื้นที่เหลือ 1 byte
static String readInput() {
StringBuffer buffer = new StringBuffer();
try {
FileInputStream fis = new FileInputStream("test.txt");
InputStreamReader isr = new InputStreamReader(fis,"UTF8");
Reader in = new BufferedReader(isr);
int ch;
while ((ch = in.read()) > -1) {
buffer.append((char)ch);
}
in.close();
return buffer.toString();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
static void writeOutput(String str) {
try {
FileOutputStream fos = new FileOutputStream("test2.txt");
Writer out = new OutputStreamWriter(fos, "TIS620");
out.write(str);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
วิธีการทดสอบ
1.สร้างไฟล์ test.txt ที่มีภาษาไทย เข้ารหัสด้วย UTF-8 แล้วเปิดดูแบบ hex viewer ด้วย EditPlus จะเห็นว่าภาษาไทยแต่ละตัวใช้ 3 bytes
2.รันโปรแกรม ทดสอบ
3.แล้วเปิด test2.txt แบบ hex viewer ด้วย EditPlus จะเห็นว่าภาษาไทยแต่ละตัวใช้ 1 byte
อ้างอิง
http://download.oracle.com/javase/tutorial/i18n/text/stream.html
1) ที่ Linux
#yum install mod_ssl เพื่อที่จะได้คำสั่ง openssl
แบบ Self-Signed
=============
2)Create a RSA private key for your server (will be Triple-DES encrypted and PEM formatted):
$ openssl genrsa -des3 -out server.key 1024
3) Create a self-signed Certificate (X509 structure) with the RSA key you just created (output will be PEM formatted):
$ openssl req -new -x509 -nodes -sha1 -days 365 -key server.key -out server.crt
*****จากนั้นนำ server.key กับ server.crt ไปใช้งาน โดยระบุใน apache configuration file (ssl.conf)
แบบส่ง Public key ไป Sign กับ ROOT CA (cacert.org)
===========================
2) Create a RSA private key for your Apache server (will be Triple-DES encrypted and PEM formatted):
$ openssl genrsa -des3 -out server.key 1024
3) Create a Certificate Signing Request (CSR) with the server RSA private key (output will be PEM formatted):
$ openssl req -new -key server.key -out server.csr
เมื่อได้ไฟล์ server.csr แล้วจึงนำไปสร้าง Certificate ที่ website cacert.org จะได้เนื้อหาของไฟล์ server.crt
****จากนั้นนำ server.key กับ server.crt ไปใช้งาน โดยระบุใน apache configuration file (ssl.conf)
****ข้อจำกัดคือจะได้ Certificate ที่มีอายุเพียง 6 เดือน
http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html
http://www.cacert.org
http://www.ubuntu.com/download/ubuntu/download
http://www.ubuntu.com/download/server/download
เมื่อ download apache2.2.XX.tar.gz มาแล้ว ให้แตกออกแล้วเข้าไปเพื่อ compile apache source ใหม่ดังนี้
เก็บ apache ที่ Compile แล้วไว้ที่ /exec/apache2 (ซึ่ง /exec/apache2 ก็คือ $APACHE_HOME)
# ./configure –prefix=/exec/apache2 –enable-rewrite –enable-proxy=http –enable-module=so –enable-ssl
#make
#make install
ทดสอบโดยการ Start
#cd /exec/apache2/bin
#./apachectl start
ตรวจสอบว่ามี process httpd ทำงานอยู่ในระบบ
#ps -aef|grep httpd
ติดตั้ง Postgresql Server และตัว Dependencies อื่นๆ
1. #yum install postgresql-server
2. #chkconfig postgresql on
Initialize database ด้วย user root
3. #service postgresql initdb
จากข้างบนจะสร้าง user postgres มาให้เราทันทีในระบบ
มาถึงตรงนี้เราสามารถ Start postgresql Server ได้แล้ว ด้วยคำสั่ง
#/etc/rc.d/init.d/postgresql restart
———————
ทดสอบด้วย user postgres
4. #su – postgres
สร้างฐานข้อมูลทดสอบชื่อ “mydb”
5. $createdb mydb
6. $psql mydb
7. mydb=#select version();
8. mydb=#\q
อ้างอิง
http://wiki.postgresql.org/wiki/YUM_Installation
http://yum.pgrpms.org/
1. เข้าไปที่ $APACHE_HOME/bin เช่นสมมติลง apache ไว้ที่ /opt/apache2
#cd /opt/apache2
2. เข้าไปที่ bin
#cd bin
3. Output a list of modules compiled into the server:
#httpd -l
4. dump a list of loaded Static and Shared Modules
#httpd -M
5. Print the version and build parameters of httpd, and then exit
#httpd -V
อ้างอิง
http://www.cyberciti.biz/faq/find-out-apache-version/
ใช้ jconsole ซึ่งอยู่ใน $JAVA_HOME/bin/jconsole ตรวจสอบได้
ดังภาพด้านล่าง ทดสอบด้วยการ
คำถามต่อมาคือแล้วจะรู้ไปทำไม ก็คือทำให้เรารู้ว่ามีการใช้ resources ของเครื่องไปเท่าไหร่ เพื่อที่เราจะได้จัดสรรให้เหมาะสม เช่น อย่างกรณีนี้เราอาจปรับ JVM parameter ให้เหมาะสม เช่นเป็น -Xms128M -Xmx256M เพราะ web application ของเราใช้เพียง 60-70MB เท่านั้น
**หมายเหตุ ในกรณีที่นำ web application นี้ไปใช้งานจริงๆซึ่งมี data เก็บมากขึ้นในฐานข้อมูล เราควรจะต้องใช้ jconsole ตรวจสอบอีกครั้งว่า web application มีการใช้ memory เพิ่มขึ้นหรือไม่ จะได้กำหนด -Xms และ -Xmx ใหม่ให้เหมาะสมต่อไป
อ้างอิง
http://download.java.net/jdk7/docs/technotes/guides/management/jconsole.html