Highlight: Ubuntu + Nginx + PHP-FPM + Varnish for WordPress site
The current site is hosted on CentOS 6 using Apache in home lab server, so you may experience slowness due to network limitation. When I was using Apache Bench tool to test the site performance, it can only server 10 requests per second. I’ve tried using Memcache and APC, the performance gain is minimum. After use Varnish in front of Apache server, the site can server over 10,000 requests per second. Here, I am going to setup another test server using Nginx + Varnish to compare with current setup. With Nginx only, it can serve 60 requests per second. That’s 6 times faster than Apache without any cache program. Now, let’s see how much performance Nginx can gain by using Varnish compare to Apache.
W3 Total Cache support many page cache methods. For VPS or Dedicated server, it’s better to use Opcode than disk. The Alternative PHP Cache will be built into PHP6, so it’s a good to try it now.
“APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.”
On CentOS, you can install it though:
# pecl install apc
Or manually install it
# wget http://pecl.php.net/get/APC-3.1.6.tgz
# tar -xvzf APC-*.tgz
# cd APC-*
# make install
I’ve see the following error when to install APC through pecl. To solve the problem, just install pcre-devel package first
# yum install pcre-devel
/root/tmp/pear/APC/apc.c:369: error: expected specifier-qualifier-list before 'pcre' /root/tmp/pear/APC/apc.c: In function 'apc_regex_compile_array': /root/tmp/pear/APC/apc.c:430: error: 'apc_regex' has no member named 'preg' /root/tmp/pear/APC/apc.c:430: error: 'apc_regex' has no member named 'preg' /root/tmp/pear/APC/apc.c:431: error: 'apc_regex' has no member named 'nreg' /root/tmp/pear/APC/apc.c:431: error: 'apc_regex' has no member named 'nreg' /root/tmp/pear/APC/apc.c: In function 'apc_regex_match_array':
By default, Chinese characters do not work in WordPress if you didn’t originally setup your WordPress to handle it. To display or compose Chinese in your blog, you can change the WordPress database Collations to utf8_unicode_ci for all tables. If you have phpMyAdmin, you can manually change them one by one. However, it will take long time to fix all of them. Here is an easy way to change all Collations using script.
1. Create a file as: alter_mysql_tables.php
2. Copy and paste the following lines to the file and modify it using your own database connection
After migrating WordPress from shared hosting to Linode VPS, I noticed that it needs FTP login to install or upgrade plugins/themes from the Dashboard. This really bothers me since I am too lazy to do this manually. I thought there should be a solution in Google, however after two days of research, I just couldn’t find one that I can use. Suddenly, I read someone in Linode forum said he fixed the problem on Debian box by changing the ownership to www-data. So, I realized that I can do the same on my CentOS
chown -R apache.apache public_html
* This command will change the ownership of all files/folders recursively under current directory to apache.
To perform the requested action, WordPress needs to access to your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.