Category Archives: Web

WordPress with Nginx: Solve the 404 after changing permalinks structure

Today I tried to change my site’s permalinks, but I can’t visit all old posts with a 404 error. I searched for a solution and found that I can add following section in my vhost conf file under nginx configurations.

location / {
        ……
if (!-e $request_filename) {

rewrite ^(.*)$ /index.php?q=$1 last;
break;

        }
}
Then restart nginx and change the permalinks structure in wordpress. Everything goes on track now.

WordPress添加Google+按钮

今天照了一下给wordpress加google+按钮的插件,发现google-plus-one-button这个插件很好用,给大家推荐一下。

安装完插件后,只要到后台管理界面的Settings->Plus One下面设置一下+1按钮的显示样式及位置,就能在每篇文章里加上Google+的按钮,非常方便。

Use varnish to optimize wordpress site

I use ubuntu as my wordpress site’s OS. Today I followed a guide from web to use varnish to optimize my wordpress site.

First of all, install varnish:

sudo apt-get install varnish

Change the listening port of varnish, edit /etc/default/varnish, modify the default port from 6081 to 80 in DAEMON_OPTS section.

Then input the rules in /etc/varnish/default.vcl Read more »

Import articles from live space

Microsoft decided to close their blog service and release a tool which let us export articles to wordpress. I tried this tool this morning, but I found that it can only export articles to the blogs host on wordpress.com. I can’t export them to my site built by wordpress. Oops, I can only use wordpress.com to transfer the articles I wrote several years ago on live space.

First of all, I created an account on wordpress.com, then use microsoft’s migration tool to export all of my posts to wordpress.com. WordPress.com support export articles in xml format file, so I export them to my laptop. At last, open my wordpress site’s management page and import all articles from my disk.

Now, this site contains all of the articles I wrote before.

OpenVPN on Ubuntu

I was trying to create a openvpn server on my ubuntu vps today. Here is the instruction.

Make sure your package repositories and installed programs are up to date by issuing the following commands:

apt-get update
apt-get upgrade --show-upgraded

Begin by installing the OpenVPN software and the udev dependency with the following command:

apt-get install openvpn udev

The OpenVPN package provides a set of encryption-related tools called “easy-rsa”. These scripts are located by default in the /usr/share/doc/openvpn/examples/easy-rsa/ directory. However, in order to function properly, these scripts should be located in the /etc/openvpn directory. Copy these files with the following command:

cp -R /usr/share/doc/openvpn/examples/easy-rsa/ /etc/openvpn Read more »