<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenX中文研究 &#187; 模式&amp;应用</title>
	<atom:link href="http://openxchina.org/archives/category/apply/feed" rel="self" type="application/rss+xml" />
	<link>http://openxchina.org</link>
	<description>研究OpenX中文环境的应用，以及基于OpenX在中国环境下的业务模式应用</description>
	<lastBuildDate>Tue, 04 May 2010 02:29:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>基于Nginx, lighttpd/apache上的OpenX高性能集群配置手册</title>
		<link>http://openxchina.org/archives/368</link>
		<comments>http://openxchina.org/archives/368#comments</comments>
		<pubDate>Sun, 21 Feb 2010 02:01:29 +0000</pubDate>
		<dc:creator>pinson</dc:creator>
				<category><![CDATA[模式&应用]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[手册]]></category>
		<category><![CDATA[规模应用]]></category>
		<category><![CDATA[集群]]></category>

		<guid isPermaLink="false">http://openxchina.org/?p=368</guid>
		<description><![CDATA[本文英文原文地址：http://www.sherin.co.in/openxcluster121/ 编者注：本文非常详细的描述了OpenX集群的配置方法，对于想通过OpenX做大规模服务的应用来说应该有比较大的帮助。原文是英文的，为了保证意思的表达就不翻译成中文了。 1. Introduction 1.1 Why the name 121 Cluster? 1.2 Technology 2. System Requirements 2.1 Load Balancer Node 2.2 Web Servers Node 2.3 Database Server Node 3. Install and Configure Load Balancer 4. Install and Configure Webserver 4.1 File system configuration 4.2 Lighttpd installation 4.3 Apache installation 5. Install and Configure Database Server 6. [...]]]></description>
			<content:encoded><![CDATA[<p>本文英文原文地址：<a href="http://www.sherin.co.in/openxcluster121/">http://www.sherin.co.in/openxcluster121/</a></p>
<p>编者注：本文非常详细的描述了OpenX集群的配置方法，对于想通过OpenX做大规模服务的应用来说应该有比较大的帮助。原文是英文的，为了保证意思的表达就不翻译成中文了。</p>
<h3><a href="#introduction">1. Introduction </a></h3>
<p><a href="#whyc">1.1 Why the name 121 Cluster?</a></p>
<p><a href="#tech">1.2 Technology</a></p>
<h3><a href="#requirements">2. System Requirements</a></h3>
<p><a href="#lbn">2.1 Load Balancer Node</a><br />
<a href="#wsn">2.2 Web Servers  Node </a><br />
<a href="#sr">2.3 Database Server Node</a></p>
<h3><a href="#ho">3. Install and Configure Load Balancer</a></h3>
<h3><a href="#ossh">4. Install and Configure Webserver</a></h3>
<p><a href="#upr">4.1 File system configuration </a><br />
<a href="#usr">4.2  Lighttpd installation</a><br />
<a href="#sc">4.3 Apache installation</a></p>
<h3><a href="#dbserver">5. Install and Configure Database Server</a></h3>
<h3><a href="#optimization">6. Optimization</a></h3>
<h3><a href="#author">Appendix-A About The Author</a></h3>
<h3><a href="#license">Appendix-B License</a></h3>
<h3><a name="introduction">1. Introduction </a></h3>
<p>This document help you to setup a simple cluster for starters. This  configuration using the best and popular software configuration for getting  better stability and performance. This can be used for Openx cluster platforms  and large vbulletin forums. Please not this is not a high availability solution  but cluster. You can build this cluster with a minimum of 4 servers.</p>
<h4><a name="whyc">1.1 Why the name 121 Cluster?</a></h4>
<p>Let me explain 1-2-1 cluster means ,</p>
<ul>
<li>1 &#8211; Load balancer</li>
<li>2 &#8211; Werbserver , or multiple of 2</li>
<li>1 &#8211; Database server</li>
</ul>
<p>So this configuration is based on one load  balancer , two or multiple of 2&#8242;s of webservers and one database server. Here  all are servers there is no need to buy external devices. This is the simplest  and well optimized cluster that you can build. You can see a graphical  representation of this cluster as below,</p>
<div><img src="http://openxchina.org/wp-content/uploads/HLIC/dd2065731ac9cd0c5616dc180e1c1c01.png" alt="" /></div>
<h4><a name="tech">1.2 Technology </a></h4>
<p>We are here using Nginx webserver as http load balanced Proxy. It is the most  popular proxy application and around 6% of high traffic websites in this world  usin nginx. Some example sites using nginx are <a href="http://wordpress.com/">wordpress.com</a> ,<a href="http://www.rambler.ru/">rambler.ru</a>,<a href="http://blog.fastmail.fm/2007/01/04/webimappop-frontend-proxies-changed-to-nginx/">fastmail.fm</a></p>
<p>Behind these proxies we use lighttpd as webservers for hosting our  application. Lighttpd is a fast webserver with light foot print. It can simply  handle millions of requests without increasing server load.It is designed and  optimized for high performance environments. With a small memory footprint  compared to other web-servers, effective management of the cpu-load, and  advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and  many more) lighttpd is the perfect solution for every server that is suffering  load problems.</p>
<h3><a name="requirements">2. System Requirements</a></h3>
<p>Here we using the best webservers and proxy applications available on  industry. It is fully a service based cluster. So no worry about kernel panics  and OS corruptions. Also if you have a private LAN across these nodes, it is  good to configure it otherwise you need to proxify the access over internet.</p>
<h4><a name="lbn">2.1 Load Balancer Node</a></h4>
<p>This node is your public node,, That means your Openx/website domain is  pointing to this server IP. I recommend to install ubuntu server Operating  system/ Centos for your load balanced server. Here in this article I am  mentioning the procedure based on ubuntu.</p>
<h4><a name="wsn">2.2 Web Servers Node</a></h4>
<p>You may need a minimum of two webservers or multiple of 2, beacuse I am  configuring GlusterFS between these webservers for file sharing. GlusterFS is  one of the top cluster file system which is built on ext3. With 4 webservers you  can configure a RAID10 like GlusterFs file system. That mean your cluster will  work if 50% of node go down. It have automatic mirroring and scaling capacity.  So there is no need to sync your website / openx contents regularly.</p>
<p>You can chose centos/ubuntu Os as operating system in webserver nodes. If you  going to install cPanel then you can only use apache as webservers. Also  remember the webservers must need same type of hardware configurations.</p>
<h4><a name="sr">2.3 Database Server Node</a></h4>
<p>As it is a single cluster we only use one database sever for Mysql. I  recommend to use a bigger configuration of for this server as follows,</p>
<ul>
<li>Processor -Dual Quad core AMD/ Xeon</li>
<li>RAM &#8211; 12 GB</li>
<li>HDD &#8211; SAS RAID 10</li>
</ul>
<p>Again Use Centos as operating system in this  server</p>
<h3><a name="ho">3. Install and Configure Load Balancer</a></h3>
<p>Please see the picture , the top one is load balance. Let us use the same IP  as in this example. Download the latest stable version of Nginx from <a href="http://nginx.net/">here</a> .I used nginx-0.7.62.tar.gz . Please proceed  as follows.</p>
<pre>
# wget -c http://sysoev.ru/nginx/nginx-0.7.62.tar.gz
# tar -xzf nginx-0.7.62.tar.gz
# cd nginx-0.7.62/
# ./configure --prefix=/opt/nginx
# make
# make install
</pre>
<p>Please resolve the dependencies before make.</p>
<p>Now we installed Nginx here. It is a best webserver eventhough we can use it  as load balanced proxy. The Nginx configuration file is  /opt/nginx/conf/nginx.conf . Add the following contents to  /opt/nginx/conf/nginx.conf</p>
<pre>
user  nobody;
worker_processes  5;

error_log  logs/error.log;
pid        logs/nginx.pid;

events {
    worker_connections  4096;
}

http {
    include     mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;

    #gzip  on;

        upstream my_openx_site {
        server 10.0.0.11:80 weight=5;  # this is your webserver www1
        server 10.0.0.12:80 weight=5;  # this is your web server www2
        }

        server {
                 listen 80;
                server_name localhost;
                location / {
                         proxy_pass http://my_openx_site;
                }
        }

}
</pre>
<p>The above configuration have 5 worker processor and can handle 4096 requests  per second. If you need more connections increase the limits.<br />
Now add a user  and group</p>
<pre>
# useradd nobody
# groupadd nobody
</pre>
<p>Now give suitable permission for log folders.</p>
<pre>
# chown -R nobody.nobody  /opt/nginx/logs/
</pre>
<p>Now we need to create a  startup script. I have done some modification for the initscript as follows.  Remember this is for ubuntu. Please copy the following contents to  /etc/init.d/nginx</p>
<pre>
#! /bin/sh
### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: nginx init.d script for Ubuntu 8.10 and lesser versions.
# Description:       nginx init.d script for Ubuntu 8.10 and lesser versions.
### END INIT INFO
#------------------------------------------------------------------------------
# nginx - this script, which starts and stops the nginx daemon for ubuntu.
#
# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
#               proxy and IMAP/POP3 proxy server.  This \
#               script will manage the initiation of the \
#               server and its process state.
#
# processname: nginx
# config:      /opt/nginx/conf/nginx.conf
# pidfile:     /opt/nginx/logs/nginx.pid
# Provides:    nginx
#                                                                                                                                                                                                                                 

# Notes: nginx init.d script for Ubuntu 8.10 and lesser versions.
 Functions
#------------------------------------------------------------------------------
. /lib/lsb/init-functions                                                                                                                                                                                                         

#------------------------------------------------------------------------------
#                               Consts
#------------------------------------------------------------------------------
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/opt/nginx/sbin/nginx                                                                                                                                                                                                      

NAME=nginx
DESCRIPTION="Nginx Server..."                                                                                                                                                                                                     

PIDSPATH=/opt/nginx/logs
PS=$NAME                                #the process, which happens to be the NAME
PIDFILE=$NAME.pid                       #pid file
RUNAS=root                              #user to run as                                                                                                                                                                           

SCRIPT_OK=0                             #ala error codes
SCRIPT_ERROR=1                          #ala error codes
TRUE=1                                  #boolean
FALSE=0                                 #boolean                                                                                                                                                                                  

lockfile=/var/lock/subsys/nginx
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"                                                                                                                                                                                      

#------------------------------------------------------------------------------
#                               Simple Tests
#------------------------------------------------------------------------------                                                                                                                                                   

#test if nginx is a file and executable
test -x $DAEMON || exit 0                                                                                                                                                                                                         

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
        . /etc/default/nginx
fi                                                                                                                                                                                                                                

#set exit condition
#set -e                                                                                                                                                                                                                           

#------------------------------------------------------------------------------
#                               Functions
#------------------------------------------------------------------------------                                                                                                                                                   

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

getPSCount() {
        return `pgrep -f $PS | wc -l`
}                                                                                                                                                                                                                                 

isRunning(){
        pidof_daemon
        PID=$?                                                                                                                                                                                                                    

        if [ $PID -gt 0 ]; then
                return 1
        else
                return 0
        fi
}                                                                                                                                                                                                                                 

status(){
        isRunning
        isAlive=$?                                                                                                                                                                                                                

        if [ "${isAlive}" -eq $TRUE ]; then
                echo "$NAME found running with processes:  `pidof $PS`"
        else
                echo "$NAME is NOT running."
        fi                                                                                                                                                                                                                        

}                                                                                                                                                                                                                                 

removePIDFile(){
        if [ -f $PIDSPATH/$NAME.pid ]; then
                rm $PIDSPATH/$NAME.pid
        fi
}                                                                                                                                                                                                                                 

start() {
        log_daemon_msg "Starting $DESCRIPTION"                                                                                                                                                                                    

        isRunning
        isAlive=$?                                                                                                                                                                                                                

        if [ "${isAlive}" -eq $TRUE ]; then
                log_end_msg $SCRIPT_ERROR
        else
                start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON
                chmod 400 $PIDSPATH/$PIDFILE
                log_end_msg $SCRIPT_OK
        fi
}                                                                                                                                                                                                                                 

stop() {
        log_daemon_msg "Stopping $DESCRIPTION"                                                                                                                                                                                    

        isRunning
        isAlive=$?
        if [ "${isAlive}" -eq $TRUE ]; then
                start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE                                                                                                                                                     

                removePIDFile                                                                                                                                                                                                     

                log_end_msg $SCRIPT_OK
        else
                log_end_msg $SCRIPT_ERROR
        fi
}                                                                                                                                                                                                                                 

reload() {
        configtest || return $?                                                                                                                                                                                                   

        log_daemon_msg "Reloading (via HUP) $DESCRIPTION"                                                                                                                                                                         

        isRunning
        if [ $? -eq $TRUE ]; then
                `killall -HUP $PS` #to be safe                                                                                                                                                                                    

                log_end_msg $SCRIPT_OK
        else
                log_end_msg $SCRIPT_ERROR
        fi
}                                                                                                                                                                                                                                 

terminate() {
        log_daemon_msg "Force terminating (via KILL) $DESCRIPTION"                                                                                                                                                                

        PIDS=`pidof $PS` || true                                                                                                                                                                                                  

        [ -e $PIDSPATH/$PIDFILE ] &amp;&amp; PIDS2=`cat $PIDSPATH/$PIDFILE`                                                                                                                                                               

        for i in $PIDS; do
                if [ "$i" = "$PIDS2" ]; then
                        kill $i
                        removePIDFile
                fi
        done                                                                                                                                                                                                                      

        log_end_msg $SCRIPT_OK                                                                                                                                                                                                    

}

pidof_daemon() {
    PIDS=`pidof $PS` || true

    [ -e $PIDSPATH/$PIDFILE ] &amp;&amp; PIDS2=`cat $PIDSPATH/$PIDFILE`

    for i in $PIDS; do
        if [ "$i" = "$PIDS2" ]; then
            return 1
        fi
    done
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|force-reload)
        stop
        start
        ;;
  reload)
        $1
        ;;
  status)
        status
        ;;
  configtest)
        $1
        ;;
  terminate)
        $1
        ;;
  *)
        FULLPATH=/etc/init.d/$NAME
        echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|terminate}"
        exit 1
        ;;
esac

exit 0
</pre>
<p>Now give execute permission to this script</p>
<pre>
# chmod 755 /etc/init.d/nginx
</pre>
<p>This is all about Load balancer configuration. You can start the Load  balance, before that you may need to build your webservers as described below,</p>
<h3><a name="ossh">4. Install and Configure Webserver</a></h3>
<p>Now we need to configure our web servers. All request came to Load balancer  will be passed to your webserver. You can use lighttpd or apache2.2.x as  webserver . I recommend to you lighttpd as webserver , because it can handle  very high traffic websites with zero load. Before that we are going to configure  gluster fs file system among the webserver. These file system is very scalable  and high available.</p>
<h4><a name="upr">4.1 File system configuration</a></h4>
<p>If you don&#8217;t need a common file system, please skip this step.Let us use the  minimal number of webservers for Glusterfs. If you have 4 webservers, it is easy  to setup a RAID10 model cluster file system. Here we use two  servers.<br />
Download the latest stable version of glusterfs from  http://www.gluster.com/ . I here used version glusterfs-2.0.2</p>
<pre>
# tar -xzf 	 glusterfs-2.0.2.tar.gz
# cd 	glusterfs-2.0.2/
# ./configure
# make
# make install
</pre>
<p>Now create the configuration files as follows.</p>
<pre>
# mkdir /etc/glusterfs/
# touch /etc/glusterfs/glusterfsd.vol
</pre>
<p>The server itself can act as server and client . The GFS server configuration  is /etc/glusterfs/glusterfsd.vol . Now add the following contents to this file.</p>
<pre>
# file: /etc/glusterfs/glusterfsd.vol
volume posix
  type storage/posix
  option directory /data    # this partition is sharing
end-volume

volume locks
  type features/locks
  subvolumes posix
end-volume

volume brick
  type performance/io-threads
  option thread-count 8
  subvolumes locks
end-volume

volume server
  type protocol/server
  option transport-type tcp
  option auth.addr.brick.allow *
  subvolumes brick
end-volume
</pre>
<p>Now create the GlusterFS client configuration file  /etc/glusterfs/glusterfs-client.vol as follows</p>
<pre>
# file  /etc/glusterfs/glusterfs-client.vol
volume remote1
  type protocol/client
  option transport-type tcp
  option remote-host 10.0.0.11
  option remote-subvolume brick
end-volume
volume remote2
  type protocol/client
  option transport-type tcp
  option remote-host 10.0.0.12
  option remote-subvolume brick
end-volume
volume distribute
  type cluster/distribute
  subvolumes remote1 remote2
end-volume
volume writebehind
  type performance/write-behind
  option window-size 1MB
  subvolumes distribute
end-volume
volume cache
  type performance/io-cache
  option cache-size 512MB
 subvolumes writebehind
end-volum
</pre>
<p>So now we have both client and server configuration for the Glusterfs file  system. Here the /data partition is sharing around the webservers. You may need  to create same configuration in all webservers.<br />
Now start the glusterfs  server</p>
<pre>
# /etc/init.d/glusterfsd  start
</pre>
<p>Now mount the file system to /home  as follows</p>
<pre>
# glusterfs -f /etc/glusterfs/glusterfs-client.vol /home
</pre>
<p>Add the above line to rc.local file so during reboot your file system  will mount automatically. So now we have a common files system among the  webserver nodes.</p>
<h4><a name="usr">4.2 Lighttpd installation</a></h4>
<p>Please note either you install lighttpd as webserver or use apache. If you  going to chose apache please jump to next step.<br />
Download the lighty from  http://www.lighttpd.net/download I used the latest version.</p>
<pre>
# wget -c http://www.lighttpd.net/download/lighttpd-1.4.23.tar.gz
# tar -xzf lighttpd-1.4.23.tar.gz
# cd lighttpd-1.4.23/
# ./configure --prefix=/opt/lighttpd --enable-fastcgi  --with-openssl
# make
# make install
# mkdir -p /etc/lighttpd/
# cp doc/lighttpd.conf  /etc/lighttpd/
# cp doc/rc.lighttpd.redhat  /etc/init.d/lighttpd
# chmod 755  /etc/init.d/lighttpd
</pre>
<p>Now edit the init script /etc/init.d/lighttpd and update the following line  as given below,</p>
<pre>
lighttpd="/opt/lighttpd/sbin/lighttpd"
</pre>
<p>ow we need to configure lighttpd with php. Please install php as fcgi  module. It is easy<br />
Download the latest stable php from http://php.net/ and  extract it. Now build it as follows,</p>
<pre>
# /configure --prefix=/usr/local/php5/  \
	--with-config-file-path=/usr/local/php5/etc \
	 --enable-force-cgi-redirect --enable-fastcgi\
	--with-gd --with-jpeg-dir=/usr/local --with-zlib \
	--with-openssl  --with-mysql
# make
# make install
# cp php.ini-dist  /usr/local/php5/etc/php.ini
</pre>
<p>Now edit /etc/lighttpd/lighttpd.conf as follows.</p>
<pre>
server.modules              = (
                               "mod_access",
                               "mod_fastcgi",
                               "mod_proxy",
                               "mod_scgi",
                               "mod_simple_vhost",
                               "mod_evhost",
                               "mod_accesslog" ) 

server.document-root        = "/home/openx/public_html"
server.errorlog             = "/var/log/lighttpd/error.log"
index-file.names            = ( "index.php", "index.html",
                               "index.htm", "default.htm" )
mimetype.assign             = (
  ".pdf"          =&gt;      "application/pdf",
  ".sig"          =&gt;      "application/pgp-signature",
  ".spl"          =&gt;      "application/futuresplash",
  ".class"        =&gt;      "application/octet-stream",
  ".ps"           =&gt;      "application/postscript",
  ".torrent"      =&gt;      "application/x-bittorrent",
  ".dvi"          =&gt;      "application/x-dvi",
  ".gz"           =&gt;      "application/x-gzip",
  ".pac"          =&gt;      "application/x-ns-proxy-autoconfig",
  ".swf"          =&gt;      "application/x-shockwave-flash",
  ".tar.gz"       =&gt;      "application/x-tgz",
  ".tgz"          =&gt;      "application/x-tgz",
  ".tar"          =&gt;      "application/x-tar",
  ".zip"          =&gt;      "application/zip",
  ".mp3"          =&gt;      "audio/mpeg",
  ".m3u"          =&gt;      "audio/x-mpegurl",
  ".wma"          =&gt;      "audio/x-ms-wma",
  ".wax"          =&gt;      "audio/x-ms-wax",
  ".ogg"          =&gt;      "application/ogg",
  ".wav"          =&gt;      "audio/x-wav",
  ".gif"          =&gt;      "image/gif",
  ".jar"          =&gt;      "application/x-java-archive",
  ".jpg"          =&gt;      "image/jpeg",
  ".jpeg"         =&gt;      "image/jpeg",
  ".png"          =&gt;      "image/png",
  ".xbm"          =&gt;      "image/x-xbitmap",
  ".xpm"          =&gt;      "image/x-xpixmap",
  ".xwd"          =&gt;      "image/x-xwindowdump",
  ".css"          =&gt;      "text/css",
  ".html"         =&gt;      "text/html",
  ".htm"          =&gt;      "text/html",
  ".js"           =&gt;      "text/javascript",
  ".asc"          =&gt;      "text/plain",
  ".c"            =&gt;      "text/plain",
  ".cpp"          =&gt;      "text/plain",
  ".log"          =&gt;      "text/plain",
  ".conf"         =&gt;      "text/plain",
  ".text"         =&gt;      "text/plain",
  ".txt"          =&gt;      "text/plain",
  ".dtd"          =&gt;      "text/xml",
  ".xml"          =&gt;      "text/xml",
  ".mpeg"         =&gt;      "video/mpeg",
  ".mpg"          =&gt;      "video/mpeg",
  ".mov"          =&gt;      "video/quicktime",
  ".qt"           =&gt;      "video/quicktime",
  ".avi"          =&gt;      "video/x-msvideo",
  ".asf"          =&gt;      "video/x-ms-asf",
  ".asx"          =&gt;      "video/x-ms-asf",
  ".wmv"          =&gt;      "video/x-ms-wmv",
  ".bz2"          =&gt;      "application/x-bzip",
  ".tbz"          =&gt;      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =&gt;      "application/x-bzip-compressed-tar",
  ""              =&gt;      "application/octet-stream",
 )                                                            

accesslog.filename          = "/var/log/lighttpd/access.log"
url.access-deny             = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
fastcgi.server = ( ".php" =&gt; ((
                     "bin-path" =&gt; "/usr/local/php5/bin/php",
                     "socket" =&gt; "/tmp/php.socket",
                     "max-procs" =&gt; 2,
                     "bin-environment" =&gt; (
                       "PHP_FCGI_CHILDREN" =&gt; "16",
                       "PHP_FCGI_MAX_REQUESTS" =&gt; "10000"
                     ),
                     "bin-copy-environment" =&gt; (
                       "PATH", "SHELL", "USER"
                     ),
                     "broken-scriptfilename" =&gt; "enable"
                 )))
</pre>
<p>So the above configuration will handle 10000 requests per children per  second. You can adjust the factcgi.server options as you wish. Remember it is  good all your webservers have same type configuration.</p>
<h4><a name="sc">4.3 Apache installation</a></h4>
<p>if you have cpanel or you are going to use apache2.2.x as webserver, please  read my previous article to know how to configure it. <a href="http://sherin.co.in/openxhandbook/">Openx Hand Book</a></p>
<h3><a name="dbserver">5. Install and Configure Database Server</a></h3>
<p>Now you can install your mysql server and configure it.</p>
<pre>
# yum install mysql-server -y
</pre>
<p>Edit the my.cnf as follows(Remember it depend on your hardware )</p>
<pre>
[mysqld]
safe-show-database
old-passwords = 1
max_connections =2048
max_user_connections = 1024
key_buffer_size = 2048M
myisam_sort_buffer_size = 64M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 4000
thread_cache_size = 384
wait_timeout = 20
connect_timeout = 10
tmp_table_size = 2048M
max_heap_table_size = 512M
max_allowed_packet = 64M
net_buffer_length = 16384
max_connect_errors = 10
thread_concurrency = 16
concurrent_insert = 2
table_lock_wait_timeout = 30
read_rnd_buffer_size = 786432
bulk_insert_buffer_size = 8M
query_cache_limit = 7M
query_cache_size = 64M
query_cache_type = 1
query_prealloc_size = 262144
query_alloc_block_size = 65536
transaction_alloc_block_size = 8192
transaction_prealloc_size = 4096
max_write_lock_count = 16
long_query_time = 5
skip-name-resolve
skip-locking

[mysqld_safe]
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer = 384M
sort_buffer = 384M
read_buffer = 256M
write_buffer = 256M
</pre>
<p>Now restart mysql server and create a database as follows</p>
<pre>
# mysqladmin create openx_db
</pre>
<p>Now go to mysql command prompt and create a user and password as  follows</p>
<pre>
#mysql&gt;grant all privileges on openx_db.* to 'openx_user'@'%' identified by 'VERYSTRONGPASSWORD';
</pre>
<p>So now for your openx configuration use host as your mysql serve  IP(here 10.0.0.20) and database user and password same as above.</p>
<h3><a name="optimization">6. Optimization</a></h3>
<p>Now it is time to optimize your servers. Please read my <a href="http://www.sherin.co.in/openxhandboook/">Openx Handbook </a>for  optimizations ,</p>
<h3><a name="author">Appendix-A About The Author</a></h3>
<p>My Name : Sherin A<br />
My Web Site : <a href="http://www.sherin.co.in/">http://www.sherin.co.in/</a> If you wan&#8217;t my  designation , you can call me, System Engineer , Security Expert , Software  Engineer or a FOSS member.<br />
About me :<br />
1) Founder of vcPanel ( Virtual  Private Server Control panel )<br />
2) Founder of FOSS award winner project  ffmpegistaller )<br />
3) Founder of FossBlog ( A Free and Open Source Software  Blog<br />
My relation with Adds : I am here with adds since 2003. Now providing  Openx services for companies US , Canad, UK, Australia, Japan , India ,Germany,  Croatia and Russia. Contact Me : All my contacts are available here or send  email to me sherinmon[at]gmail[dot]com</p>
<h3><a name="#license">Appendix-B License</a></h3>
<p>This article is licensed under Creative Commons Attribution-Noncommercial 2.5  India It means you can share and redistribute it , but give a link back to this  original document, because sometimes I will add more tips to this document.</p>
]]></content:encoded>
			<wfw:commentRss>http://openxchina.org/archives/368/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Openx试用帐号</title>
		<link>http://openxchina.org/archives/38</link>
		<comments>http://openxchina.org/archives/38#comments</comments>
		<pubDate>Sat, 01 Aug 2009 17:48:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[模式&应用]]></category>
		<category><![CDATA[试用]]></category>

		<guid isPermaLink="false">http://openxchina.org/?p=38</guid>
		<description><![CDATA[Openx官方提供了一个试用服务器，每3个小时清除数据，如果之前从没用过Openx，可以进去试用下。 Openx试用地址：http://demo.openx.org 登录帐号：chineseagency 登录密码：demo]]></description>
			<content:encoded><![CDATA[<p>Openx官方提供了一个试用服务器，每3个小时清除数据，如果之前从没用过Openx，可以进去试用下。</p>
<p>Openx试用地址：<a href="http://demo.openx.org">http://demo.openx.org</a></p>
<p>登录帐号：chineseagency</p>
<p>登录密码：demo</p>
]]></content:encoded>
			<wfw:commentRss>http://openxchina.org/archives/38/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
