Home » LxCenter » Contributed HOWTOs » Apache httpd config to compete with nginx and lighttpd
| Apache httpd config to compete with nginx and lighttpd [message #94387] |
Thu, 19 January 2012 21:42  |
|
Here is the start of a configuration that will pass the 50 user test from loadimpact.com with no sweat with a heavy php application like Drupal 7. This is from a CentOS base install and will not work for SSL or VirtualHosts as is. I will add that later. I want the community to try this out and let me know what they think in general.
The idea is that httpd-light acts as lighttpd or nginx and servers only static content. It directs php requests to the httpd config.
Here it is!:
#Install the LAMP components
yum -y install httpd mysql mysql-server php53 php53-gd php53-pdo php53-mbstring php53-xml php53-mysql
#Create init.d script for httpd-light
cp /etc/init.d/httpd /etc/init.d/httpd-light
sed -i 's/httpd Startup/httpd-light Startup/g' /etc/init.d/httpd-light
sed -i 's/processname: httpd/processname: httpd-light/g' /etc/init.d/httpd-light
sed -i 's,/etc/httpd/conf/httpd.conf,/etc/httpd-light/conf/httpd.co nf,g' /etc/init.d/httpd-light
sed -i 's,/etc/sysconfig/httpd,/etc/sysconfig/httpd-light,g' /etc/init.d/httpd-light
sed -i 's,/var/run/httpd.pid,/var/run/httpd-light.pid,g' /etc/init.d/httpd-light
sed -i 's,prog=httpd,prog=httpd-light,g' /etc/init.d/httpd-light
sed -i 's,/var/lock/subsys/httpd,/var/lock/subsys/httpd-light,g' /etc/init.d/httpd-light
sed -i '/STOP_TIMEOUT=/ a\
OPTIONS="-f /etc/httpd-light/conf/httpd.conf"' /etc/init.d/httpd-light
#Create httpd-light configuration directory and configure httpd-light
cp -r /etc/httpd/ /etc/httpd-light
sed -i 's,ServerRoot "/etc/httpd",ServerRoot "/etc/httpd-light",g' /etc/httpd-light/conf/httpd.conf
sed -i 's,PidFile run/httpd.pid,PidFile run/httpd-light.pid,g' /etc/httpd-light/conf/httpd.conf
#Create new file /etc/httpd-light/conf.d/reverseproxy.conf
echo LoadModule proxy_module modules/mod_proxy.so> /etc/httpd-light/conf.d/reverseproxy.conf
echo ProxyPreserveHost on>> /etc/httpd-light/conf.d/reverseproxy.conf
echo ProxyPassReverse / http://127.0.0.1:8080/>> /etc/httpd-light/conf.d/reverseproxy.conf
echo RewriteEngine on>> /etc/httpd-light/conf.d/reverseproxy.conf
echo RewriteCond %{REQUEST_URI} .*\\.\(php\)$>> /etc/httpd-light/conf.d/reverseproxy.conf
echo RewriteRule ^/\(.*\) http://127.0.0.1:8080/\$1 [P]>> /etc/httpd-light/conf.d/reverseproxy.conf
#No need for php on the httpd-light
rm -f /etc/httpd-light/conf.d/php.conf
#Configure httpd config
sed -i 's/Listen 80/Listen 127.0.0.1:8080/g' /etc/httpd/conf/httpd.conf
#Configure httpd for 10 max clients (uses about X MB)
sed -i 's/ServerLimit 256/ServerLimit 10/g' /etc/httpd/conf/httpd.conf
sed -i 's/MaxClients 256/MaxClients 10/g' /etc/httpd/conf/httpd.conf
#invalidate the worker config in the main httpd.conf for httpd-light
sed -i 's/<IfModule worker.c>/<IfModule worker-old.c>/g' /etc/httpd-light/conf/httpd.conf
#Configure httpd-light for worker max clients (uses about X MB)
sed 's,#HTTPD=/usr/sbin/httpd.worker,HTTPD=/usr/sbin/httpd.worke r,g' /etc/sysconfig/httpd > /etc/sysconfig/httpd-light
echo "<IfModule worker.c>
ThreadLimit 1024
StartServers 2
MaxClients 2048
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 1024
MaxRequestsPerChild 0
</IfModule>"> /etc/httpd-light/conf.d/worker.conf
chkconfig httpd on
chkconfig httpd-light on
chkconfig mysqld on
service httpd start
service httpd-light start
service mysqld start
https://www.mercuryvps.com
HyperVM Xen VPS hosting
[Updated on: Wed, 25 January 2012 21:06] Report message to a moderator
|
|
|
 |
|
Apache httpd config to compete with nginx and lighttpd
By: shazar on Thu, 19 January 2012 21:42 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Thu, 19 January 2012 22:59 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
|
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: dkstiler on Fri, 20 January 2012 16:39 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Sun, 22 January 2012 20:19 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Sun, 22 January 2012 20:40 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Wed, 25 January 2012 21:09 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Thu, 26 January 2012 09:19 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
|
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Thu, 26 January 2012 10:15 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Sat, 28 January 2012 21:00 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Sun, 29 January 2012 11:22 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
|
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Tue, 31 January 2012 09:09 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
|
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Tue, 31 January 2012 18:11 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
|
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Thu, 09 February 2012 10:24 |
 |
|
Re: Apache httpd config to compete with nginx and lighttpd
By: shazar on Fri, 10 February 2012 20:41 |
Goto Forum:
Current Time: Tue May 21 12:21:35 EDT 2013
Total time taken to generate the page: 0.01020 seconds
|