In this post, we’ll create a sll certification. Just follow the 4 steps below:

$openssl genrsa -des3 -out thuhd.com.key 4096
$openssl req -new -key thuhd.com.key -out thuhd.com.csr

Country Name: US #for example
State or Province Name: California
Locality Name: LA
Organization Name: THUHD.COM
Organizational Unit Name: HD@THU
Common Name: *.thuhd.com
Email Address: public@thuhd.com
$openssl rsa -in thuhd.com.key -out thuhd.com.nopasswd.key
$openssl x509 -req -days 365 -in thuhd.com.csr -signkey thuhd.com.nopasswd.key -out thuhd.com.crt

Then we have thuhd.com.crt thuhd.com.key thuhd.com.nopasswd.key thuhd.com.crt.

December 24th, 2009

Hello world!

1 Comment, Blog, by admin.

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
==============
I’ve moved my blog to BurstNet.

1, Install nginx, spawn-fcgi, php and mysql

#apt-get install nginx spawn-fcgi php5-cgi php5-mysql mysql-server-5.1

2, Configure nginx

#cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
#vi /etc/nginx/nginx.conf

user www www;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
use epoll;
worker_connections 1024;
multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log /var/log/nginx/access.log;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;
tcp_nodelay on;

gzip on;
gzip_disable “MSIE [1-6]\.(?!.*SV1)”;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

# mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/NginxImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities “TOP” “USER”;
# # imap_capabilities “IMAP4rev1″ “UIDPLUS”;
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
# }
#cp /etc/nginx/sites-available/default /etc/nginx/sites-available/thuhd.com
#rm -fr /etc/nginx/sites-enabled/default
#vi /etc/nginx/sites-available/thuhd.com

# You may add here your
# server {
# …
# }
# statements for each of your virtual hosts

server {
listen 80;
server_name www.thuhd.com thuhd.com 173.212.227.87;

access_log /var/log/nginx/thuhd.com.access.log;

location / {
root /var/www/thuhd.com;
try_files $uri $uri/ /index.php?q=$uri; #Rewrite rule for WordPress.
index index.php index.html index.htm;
}

#location /doc {
# root /usr/share;
# autoindex on;
# allow 127.0.0.1;
# deny all;
#}

#location /images {
# root /usr/share;
# autoindex on;
#}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www/nginx-default;
#}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/thuhd.com$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache’s document root
# concurs with nginx’s one
#
#location ~ /\.ht {
#deny all;
#}
}

# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#listen 8000;
#listen somename:8080;
#server_name somename alias another.alias;

#location / {
#root html;
#index index.html index.htm;
#}
#}

# HTTPS server
#
#server {
#listen 443;
#server_name localhost;

#ssl on;
#ssl_certificate cert.pem;
#ssl_certificate_key cert.key;

#ssl_session_timeout 5m;

#ssl_protocols SSLv2 SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_ciphers on;

#location / {
#root html;
#index index.html index.htm;
#}
#}
#ln -s /etc/nginx/sites-available/thuhd.com /etc/nginx/sites-enabled/thuhd.com
#/etc/init.d/nginx stop
#userdel www-data && useradd www
#vi /etc/passwd

……
www:x:1001:1001:,,,:/var/www:/bin/sh
……
#mkdir /var/www
#mkdir /var/www/thuhd.com
#vi /var/www/thuhd.com/index.php

<?php phpinfo(); ?>
#chown -R www:www /var/www

3, make spawn-fcgi automatically start

#cp /etc/rc.local /etc/rc.local/bak
#vi /etc/rc.local

……
if [ -x /usr/bin/spawn-fcgi ] ; then
/usr/bin/spawn-fcgi -f /usr/bin/php5-cgi -a 127.0.0.1 -p 9000 -C 3 -u www -g www
fi

exit 0

4, Compile eAccelerator and install it. Note that php5-dev can be removed when we’ve got eaccelerator.so

#apt-get install php5-dev build-essential
$wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2
$bunzip2 eaccelerator-0.9.5.3.tar.bz2
$tar xvf eaccelerator-0.9.5.3.tar
$cd eaccelerator
$./configure
$make
#cp modules/eaccelerator.so /usr/lib/php5/20060613/
#mkdir /var/cache/eaccelerator
#chown -R www:www /var/cache/eaccelerator
#cp /etc/php5/cgi/php.ini /etc/php5/cgi/php.ini.bak
#vi /etc/php5/cgi/php.ini #add the following lines to the end.


sendmail_path = /usr/sbin/sendmail #enable PHP mail() function

[eAccelerator]
extension=”eaccelerator.so” #Without pathname
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/var/cache/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″
$php5-cgi -v #reboot and test if eaccelertor is loaded by php5-cgi
PHP 5.2.11-2 with Suhosin-Patch 0.9.7 (cgi-fcgi) (built: Nov 21 2009 22:59:34)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

5, Configure mysql

$mysql -h localhost -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.37-1ubuntu5 (Ubuntu)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> create database thuhd;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on thuhd to thuhd@localhost identified by ‘***’;
Query OK, 0 rows affected (0.02 sec)

mysql> exit
Bye

December 19th, 2009

WordPress Plug-in – Comments Needed

10 Comments, Blog, by admin.

It’s a WordPress plug-in used to remind one-time visitors, for example, those who come from search engines, to post some comments when leaving, by a pop-up comfirmation dialog.

Features:
It reminds one-time visitors to post comments.
It dosen’t annoy regular visitors who have posted comments before.
Compatible with WordPress 2.9.
Compatible with IE, Firefox, Chromium/Chrome, etc.

Requirements:
The visitors’ web browser supports javascript.

Screenshots:

Comments Needed on Chromium

Comments Needed on Chromium

Change Log:
Dec, 19th, 2009: version 0.1 released.

Download:
Comments Needed on WordPress.ORG

December 15th, 2009

WordPress plug-in – Lightbox Plus

1 Comment, Blog, by admin.

Recently I tried some WordPress LightBox plug-ins, and I found that most of them have some issues that disappointed me. Then LightBox Plus catched my eyes, and I finally decided to recommend this plug-in on my blog.

Firstly, I’d like to quote the official description of LightBox Plus:

Lightbox Plus implements ColorBox as a LightBox image overlay tool for WordPress. ColorBox was created by Jack Moore of Color Powered and is licensed under the MIT License. Lightbox Plus permits users to view larger versions of images without having to leave the current page, and is also able to display simple slide shows. The use of the dark or light background, which dims the page over which the image has been overlaid, also serves to highlight the image being viewed. Lightbox Plus captures the image title for display in the overlay. Lightbox Plus is able to LightBox images displayed using WordPress build in gallery.
Lightbox Plus uses WordPress’s built in jQuery library.

Also, it has two other features. One is that it could automatically LightBox images. Another is that it provides an option to specify the display size of images. The latter feature is distinguished, since no other plug-ins, as far as I know, has this feature.

However, when I activated this plug-in on my blog, I rushed into a problem. It was because that this plug-in can handle the “a” tag and “gallery” shortcode, but no “img” tag. When I insert an image into a post, WordPress will automatically insert codes like this:

[caption id=”attachment_58″ align=”aligncenter” width=”230″ height=”230″ caption=”THUHD”]<img src=”http://www.thuhd.com/wp-content/uploads/2009/12/THUHD.png” alt=”THUHD” title=”THUHD” width=”230″ height=”230″ class=”size-medium wp-image-58″ />[/caption]

. These codes don’t have “a” tag, so I need to add it manually. The following codes will work perfectly:

[caption id=”attachment_58″ align=”aligncenter” width=”230″ height=”230″ caption=”THUHD”]<a href=”http://www.thuhd.com/wp-content/uploads/2009/12/THUHD.png” title=”THUHD”><img src=”http://www.thuhd.com/wp-content/uploads/2009/12/THUHD.png” alt=”THUHD” title=”THUHD” width=”230″ height=”230″ class=”size-medium wp-image-58″ /></a>[/caption]

It displays like this:

THUHD

THUHD

Update:
No need to manually add “a” tag any more since WordPress 2.9.

Related Link(s):
LightBox Plus

November 30th, 2009

Byethost Unavailable Temporarily

No Comments, Blog, by admin.

Today morning, when I visited my site, I got an error page, saying

ERROR

The requested URL could not be retrieved

The following error was encountered while trying to retrieve the URL: http://www.thuhd.com/
Unable to forward this request at this time.
This request could not be forwarded to the origin server or to any parent caches. The most likely cause for this error is that the cache administrator does not allow this cache to make direct connections to origin servers, and all configured parent caches are currently unreachable.
Your cache administrator is webmaster.

Generated Tue, 01 Dec 2009 01:56:35 GMT by demil1.byetcluster.com (Lusca/LUSCA_HEAD)

So byethost was down. And from this error message, we get these information:
1,Byethost.com uses squid as cache server.
2,Byethost.com uses clusters.
3,Free web hosting is not so reliable.

A simple widget to show tracks you enjoyed recently.

Features:
No javascripts.
Users can specify the username and how many tracks to display.

Requirements:
An last.fm api key.

Screenshots:

Last.fm Recent Tracks

Last.fm Recent Tracks

Download:
Sorry, not available this moment. I’ll upload it soon.

November 27th, 2009

CSStats.dat Viewer

No Comments, Blog, by admin.

A viewer to read all the data contained in csstats.dat generated by HLDS Amxx MOD.

Features:
It can read all the information contained in csstats.dat.
Users can import all the data to txt file formatted by tab spaces.
It can run on almost all linux distributions.

Requirements:
Python V2.5/2.6+ (But NO V3+)

Screenshots:

CSStats Viewer

CSStats Viewer

Download:
Sorry, not available this moment. I’ll upload it to Google Code soon.

Twitter.COM has been being blocked in china for long. This situation brings a lot of troubles to Chinese wordpress users. This plug-in is intended to help them display their tweets in wordpress. Since it gets tweets from twitter.com directly through the web server, instead of local javascripts, it’s possible to bypass the “barrier”.

Features:
No javascripts.
Users can specify the username and how many tweets to display.

Requirements:
The web server is outside China.

Screenshots:

Twitter for China

Twitter for China

Download:
Sorry, not available this moment. I’ll upload it soon.

November 27th, 2009

Hello world!

1 Comment, Blog, by admin.

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!