Archive

Archive for the ‘Webservice’ Category

nginx wordpress permalink

April 29th, 2009

As you are aware nginx don’t read .htaccess rewrite rule nginx has its own rewrite rule. Wordpress has already embraced nginx, wordpress.com works with nginx. There will be problems if you enable permalink option in wordpress nginx. Here is the workaround for it.

You can find permalink option at

Login as wordpress admin
Click on settings -> permalinks
Custom Structure /%postname%/   # This is the one I am using you can opt any other which is given as example in that page.

Now goto wp-content/plugin directory of your wordpress installation

 wget http://downloads.wordpress.org/plugin/nginx-compatibility.0.1.1.zip 

unzip it in the plugin directory
Now go to admin settings and activate this plugin. Permalink should be working now. Mind you if you have installed wordpress on a separate folder your
“location /” in nginx should look something like the below

   location / {
        root /home/user/public_html;      #replace user with actual username
        index index.html index.htm index.php;
if ($request_uri ~* ^.*/.*$) {
     rewrite ^/(w*)/(.*)$ /$1/index.php?q=$2 last;
     break;
}
}

A working example is this blog itself :)

VN:F [1.9.1_1087]
Rating: 6.2/10 (5 votes cast)
VN:F [1.9.1_1087]
Rating: 0 (from 0 votes)

Shijil T S Webservice, linux

startup scripts for nginx

April 28th, 2009

Startup script for nginx that can be used for centos. Save the below code in a file named nginx in /etc/init.d/. Chmod its permission to 755.

Also make sure that you give the correct path for your conf file in NGINX_CONF_FILE and of the nginx binary location.


#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig:   - 85 15
# description:  Nginx is an HTTP(S) server, HTTP(S) reverse
#               proxy and IMAP/POP3 proxy server
# processname: nginx
# config:      /usr/local/nginx/conf/nginx.conf
# pidfile:     /usr/local/nginx/logs/nginx.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

nginx="/usr/local/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf"

lockfile=/var/lock/subsys/nginx

start() {
    [ -x $nginx ] || exit 5
    [ -f $NGINX_CONF_FILE ] || exit 6
    echo -n $"Starting $prog: "
    daemon $nginx -c $NGINX_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog -QUIT
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    configtest || return $?
    stop
    start
}

reload() {
    configtest || return $?
    echo -n $"Reloading $prog: "
    killproc $nginx -HUP
    RETVAL=$?
    echo
}

force_reload() {
    restart
}

configtest() {
  $nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
    status $prog
}

rh_status_q() {
    rh_status >/dev/null 2>&1
}

case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart|configtest)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
        rh_status_q || exit 0
            ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
        exit 2
esac
VN:F [1.9.1_1087]
Rating: 6.7/10 (3 votes cast)
VN:F [1.9.1_1087]
Rating: 0 (from 0 votes)

Shijil T S Webservice, linux ,

Litespeed webserver

March 10th, 2009

Litespeed webserver

Internet is growing and the servers hosting the sites are thickly packed. If you are not hosting your site on a dedicated server chances are there that it is loading very slow at times.

Almost 90% of servers are based in linux which is embracing opensource software Apache as its webserver. Over a decade we haven’t seen any marked improvement in its performance with the growing demand.

Litespeed comes to your rescue at this juncture, they provide both free and enterprise version. They have provided a comparison chart with other websevers

http://www.litespeedtech.com/web-server-performance-comparison-litespeed-2.1-vs.html

We also had implemented it on our server and the site sparksupport.com is using litespeed. We could see a drastic difference in the performance. Another catch is that if your server is using a control panel like cpanel or plesk, litespeed can still work as it is portable with the existing webservice.

There is a very good documentation provided by litespeed which is a major advantage over its rivals like ngine-X.

Give it a try and experience the difference.

Update: Wed Apr 15 12:26:17 IST 2009

We moved our servers to Nginx – Cpanel combination. Now all our our servers are running Nginx.

VN:F [1.9.1_1087]
Rating: 6.3/10 (3 votes cast)
VN:F [1.9.1_1087]
Rating: 0 (from 0 votes)

admin Webservice, linux