<?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>RedHatVN Network &#187; Lighttpd</title>
	<atom:link href="http://redhatvn.net/tag/lighttpd/feed" rel="self" type="application/rss+xml" />
	<link>http://redhatvn.net</link>
	<description>Shared Linux problems</description>
	<lastBuildDate>Tue, 07 Sep 2010 08:08:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Shell Script List All Top IP Address Accessing Apache / Lighttpd Web Server</title>
		<link>http://redhatvn.net/shell-script-list-all-top-ip-address-accessing-apache-lighttpd-web-server</link>
		<comments>http://redhatvn.net/shell-script-list-all-top-ip-address-accessing-apache-lighttpd-web-server#comments</comments>
		<pubDate>Mon, 14 Dec 2009 03:45:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[check for a ddos]]></category>
		<category><![CDATA[Lighttpd]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=870</guid>
		<description><![CDATA[#!/bin/bash # Shell Script To List All Top Hitting IP Address to your webserver. # This may be useful to catch spammers and scrappers. # &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- # This script is licensed under GNU GPL version 2.0 or above # &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- # where to store final report? DEST=/var/www/reports/ips # domain name DOM=$1 # log file location [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>#!/bin/bash<br />
# Shell Script To List All Top Hitting IP Address to your webserver.<br />
# This may be useful to catch spammers and scrappers.<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# This script is licensed under GNU GPL version 2.0 or above<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# where to store final report?<br />
<span style="color: #008000;">DEST</span>=/var/www/reports/ips</p>
<p># domain name<br />
<span style="color: #008000;">DOM</span>=$1</p>
<p># log file location<br />
<span style="color: #008000;">LOGFILE</span>=/var/logs/httpd/$<span style="color: #008000;">DOM</span>/access.log</p>
<p># die if no domain name given<br />
<span style="color: #ff00ff;">[</span> $# -eq 0 <span style="color: #ff00ff;">]</span> &amp;&amp; <span style="color: #ff6600;">exit</span> 1</p>
<p># make dir<br />
<span style="color: #ff00ff;">[</span> ! -d $<span style="color: #008000;">DEST</span> <span style="color: #ff00ff;">]</span> &amp;&amp; <span style="color: #ff6600;">mkdir</span> -p $<span style="color: #008000;">DEST</span></p>
<p># ok, go though log file and create report<br />
if <span style="color: #ff00ff;">[</span> -f $<span style="color: #008000;">LOGFILE</span> <span style="color: #ff00ff;">]</span><br />
then<br />
<span style="color: #ff6600;">echo</span> &#8220;Processing log for $<span style="color: #008000;">DOM</span>&#8230;&#8221;<br />
<span style="color: #ff6600;">awk</span> &#8216;{ <span style="color: #ff6600;">print</span> $1}&#8217; $<span style="color: #008000;">LOGFILE</span> | <span style="color: #ff6600;">sort</span> | <span style="color: #ff6600;">uniq</span> -c  | <span style="color: #ff6600;"> sort</span> -nr &gt; $<span style="color: #008000;">DEST</span>/$<span style="color: #008000;">DOM</span>.txt<br />
<span style="color: #ff6600;">echo</span> &#8220;Report written to $<span style="color: #008000;">DEST</span>/$<span style="color: #008000;">DOM</span>.txt&#8221;<br />
fi</p></blockquote>
<p><span id="more-870"></span></p>
<h2>How do I run this script?</h2>
<p>Simply run it as follows:<br />
<code>./script website.com</code><br />
Sample output (1st coloum is counter and 2nd is IP address):</p>
<blockquote><p>600 72.30.87.116<br />
50 66.249.71.138<br />
10 66.249.71.140<br />
5 66.249.71.139<br />
3 74.86.49.130</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/shell-script-list-all-top-ip-address-accessing-apache-lighttpd-web-server/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Shell Script To Clean Lighttpd Web Server Cache</title>
		<link>http://redhatvn.net/shell-script-to-clean-lighttpd-web-server-cache</link>
		<comments>http://redhatvn.net/shell-script-to-clean-lighttpd-web-server-cache#comments</comments>
		<pubDate>Mon, 14 Dec 2009 03:57:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Lighttpd]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=875</guid>
		<description><![CDATA[This shell script will clean lighttpd web server cache. You need to run this script via a cron job. Download install script at /etc/cron.daily directory. #!/bin/bash # Shell script to clean web server cache stored at /var/www/cache/ directory. # &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- # This script is licensed under GNU GPL version 2.0 or above # &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- # [...]]]></description>
			<content:encoded><![CDATA[<p>This shell script will clean lighttpd web server cache. You need to run this script via a cron job. Download install script at /etc/cron.daily directory.<br />
<span id="more-875"></span></p>
<blockquote><p>
#!/bin/bash<br />
# Shell script to clean web server cache stored at /var/www/cache/ directory.<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# This script is licensed under GNU GPL version 2.0 or above<br />
# &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p># Cache dir path<br />
CROOT=&#8221;/var/www/cachelighttpd/&#8221;</p>
<p>#Deleting files older than 10 days<br />
DAYS= 10</p>
<p># Lighttpd user and group<br />
LUSER=&#8221;lighttpd&#8221;<br />
LGROUP=&#8221;lighttpd&#8221;</p>
<p># start cleaning<br />
find ${CROOT} -type f -mtime +${DAYS} | xargs -r /bin/rm</p>
<p># if directory missing just recreate it<br />
if [ ! -d $CROOT ]<br />
then<br />
mkdir -p $CROOT<br />
chown ${LUSER}:${LGROUP} ${CROOT}<br />
fi
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/shell-script-to-clean-lighttpd-web-server-cache/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Block Spam, Preventing URL Injection And Block HTTP Attacks With mod_dnsblacklist</title>
		<link>http://redhatvn.net/block-spam-preventing-url-injection-and-block-http-attacks-with-mod_dnsblacklist</link>
		<comments>http://redhatvn.net/block-spam-preventing-url-injection-and-block-http-attacks-with-mod_dnsblacklist#comments</comments>
		<pubDate>Fri, 11 Dec 2009 06:31:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Lighttpd]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=863</guid>
		<description><![CDATA[mod_dnsblacklist is a Lighttpd module that use DNSBL in order to block spam relay via web forms, preventing URL injection, block http DDoS attacks from bots and generally protecting your web service denying access to a known bad IP address. Official site: http://www.lucaercoli.it/ To install it you must download the source code and compile by [...]]]></description>
			<content:encoded><![CDATA[<p>mod_dnsblacklist is a Lighttpd module that use DNSBL in order to block spam relay via web forms, preventing URL injection, block http DDoS attacks from bots and generally protecting your web service denying access to a known bad IP address. Official site:<br />
<span id="more-863"></span><br />
<a href="http://www.lucaercoli.it/" target="_blank">http://www.lucaercoli.it/</a></p>
<p>To install it you must download the source code and compile by running these commands:</p>
<p><code>make mod_dnsblacklist.o</code></p>
<p><code>gcc -shared -o mod_dnsblacklist.so mod_dnsblacklist.o</code></p>
<p><code>/usr/bin/install -c mod_dnsblacklist.so /usr/local/lib/mod_dnsblacklist.so</code></p>
<p>The module accepts these directives:</p>
<blockquote><p>dnsblacklist.method<br />
Syntax:   dnsblacklist.method string<br />
Supported: GET, POST, HEAD, OPTIONS, PUT and PROPFIND<br />
Default:  POST</p></blockquote>
<p><span>The HTTP method on which the module acts</span></p>
<blockquote><p>dnsblacklist.host<br />
Syntax:   dnsblacklist.host string<br />
Default:  sbl-xbl.spamhaus.org</p></blockquote>
<p><span> The address of the DNSBL used</span></p>
<blockquote><p>dnsblacklist.message<br />
Syntax:   dnsblacklist.message string<br />
Default:  Your IP address is blacklisted!</p></blockquote>
<p><span> Error message displayed to the blocked user</span></p>
<p>Once installed you will need to enable it editing the Lighttpd&#8217;s configuration (<span>/etc/lighttpd/lighttpd.conf</span>). Here&#8217;s an example:</p>
<blockquote><p>server.modules = (<br />
&#8230;..<br />
&#8220;mod_dnsblacklist&#8221;,<br />
&#8230;&#8230;</p></blockquote>
<p>Finally you must restart the server</p>
<p><code>/etc/init.d/lighttpd restart</code></p>
<p>The default configuration will protect you from attacks performed with the POST method such spam relay via web forms and on your blog. To extend the protection and preventing URL injection put this in the configuration of Lighttpd:</p>
<p><code>dnsblacklist.method "GET,POST"</code></p>
<p>In order to change the error message shown to blocked users, you can use the directive &#8220;dnsblacklist.message&#8221; in this way:</p>
<p>dnsblacklist.message &#8220;Your custom message&#8221;</p>
<p>&#8230;and now fly light <img src='http://redhatvn.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/block-spam-preventing-url-injection-and-block-http-attacks-with-mod_dnsblacklist/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lighttpd mod_rrdtool: Monitor The Load, Requests Per Seconds and Traffic</title>
		<link>http://redhatvn.net/lighttpd-mod_rrdtool-monitor-the-load-requests-per-seconds-and-traffic</link>
		<comments>http://redhatvn.net/lighttpd-mod_rrdtool-monitor-the-load-requests-per-seconds-and-traffic#comments</comments>
		<pubDate>Wed, 02 Dec 2009 07:53:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Lighttpd]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=667</guid>
		<description><![CDATA[The round-robin database tool aims to handle time-series data like network bandwidth, temperatures, CPU load etc. The data gets stored in round-robin database so that system storage footprint remains constant over time. Lighttpd comes with mod_rrdtool to monitor the server load and other details. This is useful for debugging and tuning lighttpd / fastcgi server [...]]]></description>
			<content:encoded><![CDATA[<p>The round-robin database tool aims to handle time-series data like network bandwidth, temperatures, CPU load etc. The data gets stored in round-robin database so that system storage footprint remains constant over time. Lighttpd comes with mod_rrdtool to monitor the server load and other details. This is useful for debugging and tuning lighttpd / fastcgi server performance.<br />
<span id="more-667"></span></p>
<h2>Install rrdtool</h2>
<p>Type the following command if you are using CentOS / RHEL / Fedora Linux (enable <a href="http://redhatvn.net/red-hat-enterprise-linux-centos-linux-enable-epel-extra-packages-for-enterprise-linux-repository">EPEL repo</a>):<br />
<code># yum install rrdtool</code><br />
If you are using Debian / Ubuntu Linux, enter:<br />
<code># apt-get update &amp;&amp; apt-get install rrdtool</code></p>
<h2>Configure mod_rrdtool</h2>
<p>You need to use /usr/bin/rrdtool binary file. Open the lighttpd configuration file, enter:<br />
<code># vi /etc/lighttpd/lighttpd.conf</code><br />
Add the following:</p>
<blockquote><p>server.modules              += <span>(</span> <span style="color: #993333;">&#8220;mod_rrdtool&#8221;</span>  <span>)</span><br />
### RRDTOOL Config<br />
# path to the rrdtool binary<br />
rrdtool.<span style="color: #000099;">binary </span>= <span style="color: #993333;">&#8220;/usr/bin/rrdtool&#8221;</span><br />
# rrd database file<br />
rrdtool.db-<span style="color: #000099;">name </span>= <span style="color: #993333;">&#8220;/home/lighttpd/rrd&#8221;</span>
</p></blockquote>
<p>Save and close the file. Now gracefully reload lighttpd webserver:<br />
<code># service lighttpd reload</code><br />
/home/lighttpd/rrd is a filename of the rrd-database. Make sure that /home/lighttpd/rrd doesn&#8217;t exist before the first run, as lighttpd has to create the DB for you.</p>
<h2>How Do I View Graphs?</h2>
<p>You need to download and install cgi script. My cgi-bin directory is located at /home/lighttpd/cgi-bin/ (see how to <a href="http://redhatvn.net/lighttpd-setup-cgi-big-cgi-for-perl-programs">configure cgi-bin CGI</a> access under Lighttpd):</p>
<p><code>$ cd /home/lighttpd/cgi-bin/<br />
$ wget http://redmine.lighttpd.net/attachments/download/793<br />
$ chmod +x lightygraph.cgi</code></p>
<p>Open the web browser and type url:<br />
<code>http://your.domain.com/cgi-bin/lightygraph.cgi</code></p>
<p>Sample graphs:</p>
<div id="attachment_4879" style="width: 610px;"><a href="http://redhatvn.net/images/lighttpd/lighttpd-mod_rrdtool-1.png"><img title="Fig.01: Lighttpd WebServer Statistics For Last 4 Hours" src="http://redhatvn.net/images/lighttpd/lighttpd-mod_rrdtool-1.png" alt="Fig.01: Lighttpd WebServer Statistics For Last 4 Hours" width="600" height="804" /></a>Fig.01: Lighttpd WebServer Statistics For Last 4 Hours</div>
<div id="attachment_4880" style="width: 610px;"><a href="http://redhatvn.net/images/lighttpd/lighttpd-mod_rrdtool-2.png"><img title="Fig.02: Lighttpd WebServer Statistics - Daily Graphs" src="http://redhatvn.net/images/lighttpd/lighttpd-mod_rrdtool-2.png" alt="Fig.02: Lighttpd WebServer Statistics - Daily Graphs" width="600" height="796" /></a>Fig.02: Lighttpd WebServer Statistics &#8211; Daily Graphs</div>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/lighttpd-mod_rrdtool-monitor-the-load-requests-per-seconds-and-traffic/feed</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Lighttpd Setup CGI-BIG CGI For Perl Programs</title>
		<link>http://redhatvn.net/lighttpd-setup-cgi-big-cgi-for-perl-programs</link>
		<comments>http://redhatvn.net/lighttpd-setup-cgi-big-cgi-for-perl-programs#comments</comments>
		<pubDate>Wed, 02 Dec 2009 08:05:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[Lighttpd]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=675</guid>
		<description><![CDATA[httpd has mod_cgi module that allows you running Perl and other server side programs via cgi-bin directory. The Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with an information server. Step #1: Create a CGI cgi-bin Directory First you need to create a cgi-bin directory for your domain. Assuming that [...]]]></description>
			<content:encoded><![CDATA[<p>httpd has mod_cgi module that allows you running Perl and other server side programs via cgi-bin directory. The Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with an information server.<br />
<span id="more-675"></span></p>
<h2>Step #1: Create a CGI cgi-bin Directory</h2>
<p>First you need to create a cgi-bin directory for your domain. Assuming that your domain hosted at /home/lighttpd/theos.in/http (DocumentRoot), create cgi-bin as follows:<br />
<code># mkdir -p /home/lighttpd/theos.in/cgi-bin</code></p>
<h2>Step # 2: Load mod_cgi Module</h2>
<p>Open lighttpd configuration file using a text editor such as vi:<br />
<code># vi  /etc/lighttpd/ligttpd.conf</code></p>
<p>Now append or modify text as follows so that support for mod_cgi get loaded:</p>
<blockquote><p>server.modules += <span>(</span> <span style="color: #993333;">&#8220;mod_cgi&#8221;</span> <span>)</span></p></blockquote>
<p>Find out your virtual server configuration and append the following:</p>
<blockquote><p>$HTTP<span>[</span><span style="color: #993333;">"url"</span><span>]</span> =~ <span style="color: #993333;">&#8220;/cgi-bin/&#8221;</span> <span>{</span><br />
      cgi.<span style="color: #000099;">assign </span>=<span style="color: #660066;"> <span>(</span> </span><span style="color: #993333;">&#8220;.pl&#8221;</span> =&gt; <span style="color: #993333;">&#8220;/usr/bin/perl&#8221;</span> <span>)</span><br />
<span>}</span></p></blockquote>
<p>Here is complete my config code:</p>
<blockquote><p>$HTTP["host"]  =~ &#8220;theos.in&#8221; {<br />
  server.document-root = &#8220;/home/lighttpd/theos.in/http&#8221;<br />
  accesslog.filename         = &#8220;/var/log/lighttpd/theos.in/access.log&#8221;<br />
  $HTTP["url"] =~ &#8220;/cgi-bin/&#8221; {<br />
      cgi.assign = ( &#8220;.pl&#8221; =&gt; &#8220;/usr/bin/perl&#8221; )<br />
  }<br />
}</p></blockquote>
<h3>Step # 3:Restart the Lighttpd</h3>
<p>Restart lighttpd webserver, enter:<br />
<code># /etc/init.d/lighttpd restart</code></p>
<h3>Step # 4: Test It</h3>
<p>Create a file/perl program in /home/lighttpd/theos.in/cgi-bin/sample.pl:</p>
<blockquote><p><span style="color: #808080; font-style: italic;">#!/usr/bin/perl</span><br />
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&#8220;Content-Type: text/plain&#8221;</span>, <span style="color: #ff0000;">&#8220;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&#8220;</span>;<br />
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&#8220;Hi there! This is a sample perl program!!!&#8221;</span>, <span style="color: #ff0000;">&#8220;<span style="color: #000099; font-weight: bold;">\n</span>&#8220;</span>;</p></blockquote>
<p>Save and execute the program (http://yourdomain.com/cgi-bin/sample.pl).</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/lighttpd-setup-cgi-big-cgi-for-perl-programs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->