Category Archives: Web - Page 2

Using nginx+fastcgi to serve django request

Nginx is a fast and efficient HTTP and reverse proxy server. It’s suitable for building heavy traffic website. Python is a popular language because of it’s simpleness and fast develop speed. Django is no doubt the most used web development framework developed in python. Today I will write down how to make django work with nginx and fastcgi.

My development environment is based on ubuntu server. It’s very convinient to make it done under ubuntu. At first, install softwares we need.

# sudo apt-get install python-django python-flup spawn-fcgi nginx

Then add the following sentences in the nginx config file:

location / {
    # host and port to fastcgi server
    fastcgi_pass 127.0.0.1:8801;
    fastcgi_param PATH_INFO $fastcgi_script_name;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_pass_header Authorization;
    fastcgi_intercept_errors off;
}

At last, use the command to start fastcgi process:

# python manage.py runfcgi method=threaded host=127.0.0.1 port=8801

Open your browser and open http://localhost, if you see the django test page, then congratulations! You succeed.

25 Tips for Marketing Your Blog – Lee Odden

from: http://www.toprankblog.com/2006/06/25-tips-for-marketing-your-blog/

With so many blogs being created every day, it’s a mystery to many bloggers how to make their blog stand out. There are many types of blogs or purposes for blogs and a certain number of tactics are applicable to just about all of them.Some companies choose to hire ablog consultant, but others like to try things internally. For those “DIY” companies and individuals interested in practical tips for marketing and optimizing a business blog, try out the following list of blog marketing and optimization tips:

  1. Decide on a stand alone domain name www.myblog.com or directory of existing site www.mysite.com/blog. Sub domain is also an option blog.mysite.com. Avoid hosted services that do not allow you to use your own domain name!
  2. Obtain and install customizable blog software – WordPress and Moveable Type are my favorites.
  3. Customize blog look and feel templates – aka design.
  4. Research keywords and develop a glossary – Keyword Discovery, WordTracker, SitePoint, SEOBook Keyword Research.
  5. Optimize the blog:
    • Template optimization – RSS subscription options, social bookmark links, HTML code, Unique title tags, URLs, Sitemap
    • Add helper plugins specific to WordPress or MT
    • Create keyword rich categories (reference your keyword glossary)
  6. Enable automatic trackback and ping functionality. Read more »

Add google translator on my blog

I use both Chinese and English to publish articles on my blog, but I think it’s unfair to my blog visitors from all over the world. So today I search for a solution and add google translator to my wordpress site.

The process of adding this plugin is easy. Install a plugin named Google Ajax Translation on wordpress at first and active it. Then go to Settings page and click the translation plugins item. There are several options for user to customize the plugin’s behaviour. Save it.

Now visit your site, you will see a translate link on your page or posts. Click it, a panel will be shown contains the languages you selected in the settings page. Your site’s visitors have a chance to read your post in their language now. That’s a good user experience.

Use Zend Optimizer to enhance php performance

PHP is fast enough, but zend optimizer can enhance php performance by 30%, it’s a great improvement. And I decided to use it in my site.

To install zend optimizer is very simple. First, download zend optimizer and extract it. Move ZendOptimizer.so (Depend on your php version, I use php 5.2) to /usr/local/lib/Zend.

# mv zendoptimizer/data/5_2_x_comp/ZendOptimizer.so /usr/local/lib/Zend/ZendOptimizer.so

Edit php.ini file:

# vim /etc/php5/cgi/php.ini

Add two lines into this file:

zend_extension=/usr/local/lib/Zend/ZendOptimizer.so
zend_optimizer.optimization_level=15
Then restart the server:
# /etc/init.d/nginx restart
#/etc/init.d/init-fastcgi restart
The “init-fastcgi” is my script to start spawn-fcgi, the content of this file is in my previous post about use php in nginx. OK, the site has got power from zend optimizer now.

Move to linode vps

I have moved my site from vpslink to linode yesterday. As many people recommended Linode to me, I consider it’s a great vps provider. And the speed is okay. I am willing to recommend it to anyone who want get a vps. If you are interested in it. Give a try, you will satisfied with it, too.

My referral code: d52914b08fd9372ae9bff6b5c30662ac7cdc2ab2

And the direct entry URL is:
http://www.linode.com/?r=d52914b08fd9372ae9bff6b5c30662ac7cdc2ab2