<?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>9tutorials - The best collection of tutorials &#187; Hosting</title>
	<atom:link href="http://9tutorials.com/category/hosting/feed" rel="self" type="application/rss+xml" />
	<link>http://9tutorials.com</link>
	<description>Photoshop tutorials , Flash tutorials, PHP tutorials and much more</description>
	<lastBuildDate>Sat, 20 Feb 2010 20:24:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rule-based DoS attacks prevention shell script</title>
		<link>http://9tutorials.com/2007/05/21/rule-based-dos-attacks-prevention-shell-script.html</link>
		<comments>http://9tutorials.com/2007/05/21/rule-based-dos-attacks-prevention-shell-script.html#comments</comments>
		<pubDate>Mon, 21 May 2007 08:57:30 +0000</pubDate>
		<dc:creator>dangtruong</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[dos]]></category>
		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://9tutorials.com/2007/05/21/rule-based-dos-attacks-prevention-shell-script.html</guid>
		<description><![CDATA[ In this article, I describe a simple rule-based DoS attack-prevention shell script.  However, the proposed shell script is not a perfect tool for preventing DoS attacks, but a powerful tool for alleviating DoS attacks overheads of the Linux servers significantly.
In order to understand DoS or DDoS attacks, it is useful to see the [...]]]></description>
			<content:encoded><![CDATA[<div class="spost"><p> In this article, I describe a simple rule-based DoS attack-prevention shell script.  However, the proposed shell script is not a perfect tool for preventing DoS attacks, but a powerful tool for alleviating DoS attacks overheads of the Linux servers significantly.<span id="more-334"></span></p>
<p>In order to understand DoS or DDoS attacks, it is useful to see the log files in /var/log.  In this article, an ssh DoS attack-prevention shell script is mainly mentioned.  We have been observing the behavior of ssh DoS attacks through three Linux servers in the last six months.  We have been manually manipulating iptables commands for disabling the access from specific IPs, after detecting DoS attacks.  The proposed shell script is to automate the whole manipulated commands for DoS attacks prevention.  If the proposed simple shell script detects DoS attacks that match predefine rules in the shell script, then the DoS attack IPs are added to the detected-IPs file and have their access to the server disabled.  Since detecting DoS attacks is rule-based, it is expandable.  Kernel-mode implementation of the proposed idea is expected, for immediate DoS attacks prevention, instead of using crontab in this article.<br />
<!--adsense#inside--></p>
<h3> How to detect DoS attacks from /var/log/secure file</h3>
<p>In order to see /var/log/secure file, you have to be a root. In this article, &#8220;grep&#8221;, &#8220;awk&#8221;, and &#8220;sed&#8221; commands are often used for building rules in the proposed shell script.  The shell script is composed of a part of DoS attack detection rules, a part of reducing redundant IPs, and a part of disabling detected IPs.  The following is an example of the typical ssh attack using the dictionary, where every second user name is changed from root, delta, admin,,,, after the system did not receive identification string from 64.34.200.202.</p>
<pre class="code">Feb 18 09:14:08 neuro sshd[8978]: Did not receive identification string from 64.34.200.202
Feb 18 09:18:22 neuro sshd[9012]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=64.34.200.202  user=root
Feb 18 09:18:24 neuro sshd[9012]: Failed password for root from 64.34.200.202 port 43353 ssh2
Feb 18 00:18:24 neuro sshd[9013]: Received disconnect from 64.34.200.202: 11: Bye ByeFeb 18 09:18:25 neuro sshd[9015]: Invalid user delta from 64.34.200.202
Feb 18 00:18:25 neuro sshd[9016]: input_userauth_request: invalid user deltaFeb 18 09:18:25 neuro sshd[9015]: pam_unix(sshd:auth): check pass; user unknown
Feb 18 09:18:25 neuro sshd[9015]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=64.34.200.202
Feb 18 09:18:27 neuro sshd[9015]: Failed password for invalid user delta from 64.34.200.202 port 43875 ssh2
Feb 18 00:18:28 neuro sshd[9016]: Received disconnect from 64.34.200.202: 11: Bye ByeFeb 18 09:18:29 neuro sshd[9017]: Invalid user admin from 64.34.200.202
Feb 18 00:18:29 neuro sshd[9018]: input_userauth_request: invalid user admin
Feb 18 09:18:29 neuro sshd[9017]: pam_unix(sshd:auth): check pass; user unknownFeb 18 09:18:29 neuro sshd[9017]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=64.34.200.202
Feb 18 09:18:31 neuro sshd[9017]: Failed password for invalid user admin from 64.34.200.202 port 44300 ssh2</pre>
<p>The following command sends the disabled IPs information from /etc/sysconfig/iptables into tmp file.</p>
<pre class="code">grep DROP /etc/sysconfig/iptables|awk '{print $5}' &gt;tmp</pre>
<p>If the system did not receive identification string from the specific IPs, the machine access should be disabled.  The following command adds the detected IPs to a temporary file. Detected IPs using rules will be added in that file.</p>
<pre class="code">grep Did /var/log/secure|awk '{print $12}' &gt;&gt;tmp</pre>
<p>A new rule can be added to the tmp file using the simple command. The dictionary attacks can be easily detected by &#8220;Invalid user&#8221; from /var/log/secure. If you misspell in ssh login name, you may not be able to login any more from your machine. In order to re-enable login from the machine again, you must delete all the lines including your machine IP from /var/log/secure file and flush the iptables by /sbin/iptables -F.</p>
<pre class="code">grep "Invalid user" /var/log/secure|awk '{print $10}' &gt;&gt;tmp</pre>
<p>Maximum login DoS attacks can be detected by the following command.</p>
<pre class="code">grep "Maximum login" /var/log/secure|awk '{print $7}'|sed 's/.*[(.*)])/1/g' &gt;&gt;tmp</pre>
<h3>How to reduce redundant detected IPs from the temporary file</h3>
<p>The following commands reduce redundant detected IPs from the temporary file, and store the unique detected IPs in file ttt.  The variable &#8220;size&#8221; indicates the number of lines in the tmp file.</p>
<pre class="code">size=`wc tmp|awk '{print $1}'`i=0while test $i -lt $sizedous=`sed -n 1p tmp`sed /$us/d tmp &gt;tmps

echo $us &gt;&gt;ttt

cp -f tmps tmp

size=`wc tmp|awk '{print $1}'`</pre>
<pre class="code">done</pre>
<h3>How to activate /sbin/iptables</h3>
<p>DoS attack IPs are stored in file ttt.  The following simple loop activates /sbin/iptables.</p>
<pre class="code">0-59/5 * * * * /var/log/test</pre>
<p>The entire shell script /var/log/test is as follows.</p>
<pre class="code">#!/bin/bashrm -f ttttouch tmp# disabled IPs can be obtained from /etc/sysconfig/iptables

grep DROP /etc/sysconfig/iptables|awk '{print $5}' &gt;tmp

# ------------------------ DoS attacks rule -------------------------

#identity mismatch in secure

grep Did /var/log/secure|awk '{print $12}' &gt;&gt;tmp

#Invalid user

grep "Invalid user" /var/log/secure|awk '{print $10}' &gt;&gt;tmp

# Maximum login

grep "Maximum login" /var/log/secure|awk '{print $7}'|sed 's/.*[(.*)])/1/g' &gt;&gt;tmp

#

# ------------------ reduce redundant IPs from tmp file -------------

size=`/usr/bin/wc tmp|awk '{print $1}'`

i=0

while test $i -lt $size

do

us=`sed -n 1p tmp`

sed /$us/d tmp &gt;tmps

echo $us &gt;&gt;ttt

cp -f tmps tmp

size=`/usr/bin/wc tmp|awk '{print $1}'`

done

rm -f tmp tmps temp0 temp

#

# ------------------ activate detected IPs --------------------------

size=`wc ttt|awk '{print $1}'`

size=`expr $size + 1`

/sbin/iptables -F

i=1

while test $i -lt $size

do

ip=`sed -n "$i"p ttt`

i=`expr $i + 1`

/sbin/iptables -A INPUT -s $ip -j DROP

done</pre>
<pre class="code">
# -----------------end of shell script test -------------------------</pre>
<h3>Examine shell script</h3>
<p>Before running the cron shell script, you must be root and should examine the shell script by:</p>
<pre class="code">sh /var/log/test</pre>
<p>In order to see the current iptables, type the following command.</p>
<pre class="code">/sbin/iptables -nL</pre>
<h3>Conclusion</h3>
<p>Since the proposed shell script is portable, it can be placed in every server or router.  In order to share the blacklist of IPs, the shell script must be placed in every router, and router-to-router communication is needed to assemble the blacklist of IPs for the larger framework of network security.</p>
<p><em>Copyright @ 2006 Yoshiyasu Takefuji</em><em>Yoshiyasu Takefuji was heavily involved in developing a unix based color workstation in 1983 at University of South Florida. Recently he has been monitoring three Linux servers to see the behavior of DOS attacks. He is a chair of SecurityExpo in Japan since 2004 and also a chair of OECD TrustE security product evaluation committee chair in Japan, and advisor of Japan Network Security Association and CMU in Japan. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://9tutorials.com/2007/05/21/rule-based-dos-attacks-prevention-shell-script.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Configuring Apache for Maximum Performance</title>
		<link>http://9tutorials.com/2007/05/19/configuring-apache-for-maximum-performance.html</link>
		<comments>http://9tutorials.com/2007/05/19/configuring-apache-for-maximum-performance.html#comments</comments>
		<pubDate>Sat, 19 May 2007 17:49:28 +0000</pubDate>
		<dc:creator>dangtruong</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://9tutorials.com/2007/05/19/configuring-apache-for-maximum-performance.html</guid>
		<description><![CDATA[Apache server performance can be improved by adding additional hardware resources such as RAM, faster CPU, etc. But most of the time, the same result can be achieved by custom configuration of the server. This article looks into getting maximum performance out of Apache with the existing hardware resources, specifically on Linux systems. Of course, [...]]]></description>
			<content:encoded><![CDATA[<div class="spost"><p>Apache server performance can be improved by adding additional hardware resources such as RAM, faster CPU, etc.<span id="more-219"></span> But most of the time, the same result can be achieved by custom configuration of the server. This article looks into getting maximum performance out of Apache with the existing hardware resources, specifically on Linux systems. Of course, it is assumed that there is <em>enough</em> hardware resources &#8211; especially enough RAM that the server isnâ€™t swapping frequently. First two sections look into various Compile-Time and Run-Time configuration options. The Run-Time section assumes that Apache is compiled with prefork MPM. HTTP compression and caching is discussed next. Finally, using separate servers for serving static and dynamic contents is covered. Basic knowledge of compiling and configuring Apache and Linux are assumed.</p>
<h3>2 Compile-Time Configuration Options</h3>
<h4>2.1 Load only the required modules:</h4>
<p>The Apache HTTP Server is a modular program where the administrator can choose the functions to be included in the server by selecting a set of modules [2]. The modules can be compiled either statically as part of the â€™httpdâ€™ binary, or as Dynamic Shared Objects (DSOs). DSO modules can either be compiled when the server is built, or added later via the apxs utility, which allows compilation at a later date. The mod_so module must be statically compiled into the Apache core to enable DSO support.</p>
<p>Run Apache with only the required modules. This reduces the memory footprint, which improves the server performance. Statically compiling modules will save RAM thatâ€™s used for supporting dynamically loaded modules, but you would have to recompile Apache to add or remove a module. This is where the DSO mechanism comes handy. Once the mod_so module is statically compiled, any other module can be added or dropped using the â€™LoadModuleâ€™ command in the â€™httpd.confâ€™ file. Of course, you will have to compile the modules using â€™apxsâ€™ if they werenâ€™t compiled when the server was built.</p>
<h4>2.2 Choose appropriate MPM:</h4>
<p>The Apache server ships with a selection of Multi-Processing Modules (MPMs) which are responsible for binding to network ports on the machine, accepting requests, and dispatching children to handle the requests [3]. Only one MPM can be loaded into the server at any time.</p>
<p>Choosing an MPM depends on various factors, such as whether the OS supports threads, how much memory is available, scalability versus stability, whether non-thread-safe third-party modules are used, etc.</p>
<p>Linux systems can choose to use a threaded MPM like worker or a non-threaded MPM like prefork:</p>
<p>The <em>worker</em> MPM uses multiple child processes. Itâ€™s multi-threaded within each child, and each thread handles a single connection. Worker is fast and highly scalable and the memory footprint is comparatively low. Itâ€™s well suited for multiple processors. On the other hand, worker is less tolerant of faulty modules, and a faulty thread can affect all the threads in a child process.</p>
<p>The <em>prefork</em> MPM uses multiple child processes, each child handles one connection at a time. Prefork is well suited for single or double CPU systems, speed is comparable to that of worker, and itâ€™s highly tolerant of faulty modules and crashing children &#8211; but the memory usage is high, and more traffic leads to greater memory usage.</p>
<h3>3 Run-Time Configuration Options</h3>
<h4>3.1 DNS lookup:</h4>
<p>The HostnameLookups directive enables DNS lookup so that hostnames can be logged instead of the IP address. This adds latency to every request since the DNS lookup has to be completed before the request is finished. HostnameLookups is Off by default in Apache 1.3 and above. Leave it Off and use post-processing program such as logresolve to resolve IP addresses in Apacheâ€™s access logfiles. Logresolve ships with Apache.</p>
<p>When using â€™Allow fromâ€™ or â€™Deny fromâ€™ directives, use an IP address instead of a domain name or a hostname. Otherwise, a double DNS lookup is performed to make sure that the domain name or the hostname is not being spoofed.</p>
<h4>3.2 AllowOverride:</h4>
<p>If AllowOverride is not set to â€™Noneâ€™, then Apache will attempt to open the .htaccess file (as specified by AccessFileName directive) in each directory that it visits. For example:</p>
<pre class="code">DocumentRoot /var/www/html
&lt;Directory /&gt;
AllowOverride all
&lt;/Directory&gt;</pre>
<p>If a request is made for URI /index.html, then Apache will attempt to open /.htaccess, /var/.htaccess, /var/www/.htaccess, and /var/www/html/.htaccess. These additional file system lookups add to the latency. If .htaccess is required for a particular directory, then enable it for that directory alone.</p>
<h4>3.3 FollowSymLinks and SymLinksIfOwnerMatch:</h4>
<p>If FollowSymLinks option is set, then the server will follow symbolic links in this directory. If SymLinksIfOwnerMatch is set, then the server will follow symbolic links only if the target file or directory is owned by the same user as the link.<br />
<!--adsense#inside--><br />
If SymLinksIfOwnerMatch is set, then Apache will have to issue additional system calls to verify whether the ownership of the link and the target file match. Additional system calls are also needed when FollowSymLinks is NOT set.<br />
For example:</p>
<pre class="code">DocumentRoot /var/www/html
&lt;Directory /&gt;
Options SymLinksIfOwnerMatch
&lt;/Directory&gt;</pre>
<p>For a request made for URI /index.html, Apache will perform lstat() on /var, /var/www, /var/www/html, and /var/www/html/index.html. These additional system calls will add to the latency. The lstat results are not cached, so they will occur on every request.</p>
<p>For maximum performance, set FollowSymLinks everywhere and never set SymLinksIfOwnerMatch. Or else, if SymLinksIfOwnerMatch is required for a directory, then set it for that directory alone.</p>
<h4>3.4 Content Negotiation:</h4>
<p>Avoid content negotiation for fast response. If content negotiation is required for the site, use type-map files rather than Options MultiViews directive. With MultiViews, Apache has to scan the directory for files, which adds to the latency.</p>
<h4>3.5 MaxClients:</h4>
<p>The MaxClients sets the limit on maximum simultaneous requests that can be supported by the server; no more than this number of child processes are spawned. It shouldnâ€™t be set too low; otherwise, an ever-increasing number of connections are deferred to the queue and eventually time-out while the server resources are left unused. Setting this too high, on the other hand, will cause the server to start swapping which will cause the response time to degrade drastically. The appropriate value for MaxClients can be calculated as:</p>
<p>[4] MaxClients = Total RAM dedicated to the web server / Max child process size</p>
<p>The child process size for serving static file is about 2-3M. For dynamic content such as PHP, it may be around 15M. The RSS column<br />
in &#8220;<code>ps -ylC httpd --sort:rss</code>&#8221; shows non-swapped physical memory usage by Apache processes in kiloBytes.</p>
<p>If there are more concurrent users than MaxClients, the requests will be queued up to a number based on ListenBacklog directive. Increase ServerLimit to set MaxClients above 256.</p>
<h4>3.6 MinSpareServers, MaxSpareServers, and StartServers:</h4>
<p>MaxSpareServers and MinSpareServers determine how many child processes to keep active while waiting for requests. If the MinSpareServers is too low and a bunch of requests come in, Apache will have to spawn additional child processes to serve the requests. Creating child processes is relatively expensive. If the server is busy creating child processes, it wonâ€™t be able to serve the client requests immediately. MaxSpareServers shouldnâ€™t be set too high: too many child processes will consume resources unnecessarily.</p>
<p>Tune MinSpareServers and MaxSpareServers so that Apache need not spawn more than 4 child processes per second (Apache can spawn a maximum of 32 child processes per second). When more than 4 children are spawned per second, a message will be logged in the ErrorLog.</p>
<p>The StartServers directive sets the number of child server processes created on startup. Apache will continue creating child processes until the MinSpareServers setting is reached. This doesnâ€™t have much effect on performance if the server isnâ€™t restarted frequently. If there are lot of requests <em>and</em> Apache is restarted frequently, set this to a relatively high value.</p>
<h4>3.7 MaxRequestsPerChild:</h4>
<p>The MaxRequestsPerChild directive sets the limit on the number of requests that an individual child server process will handle. After MaxRequestsPerChild requests, the child process will die. Itâ€™s set to 0 by default, the child process will never expire. It is appropriate to set this to a value of few thousands. This can help prevent memory leakage, since the process dies after serving a certain number of requests. Donâ€™t set this too low, since creating new processes does have overhead.</p>
<h4>3.8 KeepAlive and KeepAliveTimeout:</h4>
<p>The KeepAlive directive allows multiple requests to be sent over the same TCP connection. This is particularly useful while serving HTML pages with lot of images. If KeepAlive is set to Off, then for each images, a separate TCP connection has to be made. Overhead due to establishing TCP connection can be eliminated by turning On KeepAlive.</p>
<p>KeepAliveTimeout determines how long to wait for the next request. Set this to a low value, perhaps between two to five seconds. If it is set too high, child processed are tied up waiting for the client when they could be used for serving new clients.</p>
<h3>4 HTTP Compression &amp; Caching</h3>
<p>HTTP compression is completely specified in HTTP/1.1. The server uses either the gzip or the deflate encoding method to the response payload before it is sent to the client. Client then decompresses the payload. There is no need to install any additional software on the client side since all major browsers support these methods. Using compression will save bandwidth and improve response time; studies have found a mean gain of %75.2 when using compression [5].</p>
<p>HTTP Compression can be enabled in Apache using the mod_deflate module. Payload is compressed only if the browser requests compression, otherwise uncompressed content is served. A compression-aware browser inform the server that it prefer compressed content through the HTTP request header &#8211; &#8220;<code>Accept-Encoding: gzip,deflate</code>&#8220;. Then the server responds with compressed payload and the response header set to &#8220;<code>Content-Encoding: gzip</code>&#8220;.</p>
<p>The following example uses telnet to view request and response headers:</p>
<pre class="code">bash-3.00$ telnet www.webperformance.org 80
Trying 24.60.234.27...
Connected to www.webperformance.org (24.60.234.27).
Escape character is â€™^]â€™.
HEAD / HTTP/1.1
Host: www.webperformance.org
Accept-Encoding: gzip,deflate

HTTP/1.1 200 OK
Date: Sat, 31 Dec 2005 02:29:22 GMT
Server: Apache/2.0
X-Powered-By: PHP/5.1.1
Cache-Control: max-age=0
Expires: Sat, 31 Dec 2005 02:29:22 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Content-Type: text/html; charset=ISO-8859-1</pre>
<p>In caching, a copy of the data is stored at the client or in a proxy server so that it need not be retrieved frequently from the server. This will save bandwidth, decrease load on the server, and reduce latency. Cache control is done through HTTP headers. In Apache, this can be accomplished through mod_expires and mod_headers modules. There is also server side caching, in which the most frequently-accessed content is stored in memory so that it can be served fast. The module mod_cache can be used for server side caching; it is production stable in Apache version 2.2.</p>
<h3>5 Separate server for static and dynamic content</h3>
<p>Apache processes serving dynamic content take from 3MB to 20MB of RAM. The size grows to accommodate the content being served and never decreases until the process dies. As an example, letâ€™s say an Apache process grows to 20MB while serving some dynamic content. After completing the request, it is free to serve any other request. If a request for an image comes in, then this 20MB process is serving static content &#8211; which could be served just as well by a 1MB process. As a result, memory is used inefficiently.</p>
<p>Use a tiny Apache (with minimum modules statically compiled) as the front-end server to serve static contents. Requests for dynamic content should be forwarded to the heavy-duty Apache (compiled with all required modules). Using a light front-end server has the advantage that the static contents are served fast without much memory usage and only the dynamic contents are passed over to the big server.</p>
<p>Request forwarding can be achieved by using mod_proxy and mod_rewrite modules. Suppose there is a lightweight Apache server listening to port 80 and a heavyweight Apache listening on port 8088. Then the following configuration in the lightweight Apache can be used to forward all requests (except requests for images) to the heavyweight server: [9]</p>
<pre class="code">ProxyPassReverse / http://%{HTTP_HOST}:8088/
RewriteEngine on
RewriteCond  %{REQUEST_URI} !.*â€™.(gif|png|jpg)$
RewriteRule ^/(.*) http://%{HTTP_HOST}:8088/$1 [P]</pre>
<p>All requests, except for images, will be proxied to the backend server. The response is received by the frontend server and supplied to the client. As far as client is concerned, all the responses seem to come from a single server.</p>
<h3>6 Conclusion</h3>
<p>Configuring Apache for maximum performance is tricky; there are no hard and fast rules. Much depends on understanding the web server requirements and experimenting with various available options. Use tools like ab and httperf to measure the web server performance. Lightweight servers such as tux or thttpd can also be used as the front-end server. If a database server is used, make sure it is optimized so that it wonâ€™t create any bottlenecks. In case of MySQL, mtop can be used to monitor slow queries. Performance of PHP scripts can be improved by using a PHP caching product such as Turck MMCache. It eliminates overhead due to compiling by caching the PHP scripts in a compiled state.</p>
<h4>Bibliography</h4>
<p>1. <a href="http://news.netcraft.com/archives/web_server_survey.html">http://news.netcraft.com/archives/web_server_survey.html</a><br />
2. <a href="http://httpd.apache.org/docs/2.2/dso.html">http://httpd.apache.org/docs/2.2/dso.html</a><br />
3. <a href="http://httpd.apache.org/docs/2.2/mpm.html">http://httpd.apache.org/docs/2.2/mpm.html</a><br />
4. <a href="http://modperlbook.org/html/ch11_01.html">http://modperlbook.org/html/ch11_01.html</a><br />
5. <a href="http://www.speedupyoursite.com/18/18-2t.html">http://www.speedupyoursite.com/18/18-2t.html</a><br />
6. <a href="http://www.xs4all.nl/%7Ethomas/apachecon/PerformanceTuning.html">http://www.xs4all.nl/~thomas/apachecon/PerformanceTuning.html</a><br />
7. <a href="http://www.onlamp.com/pub/a/onlamp/2004/02/05/lamp_tuning.html">http://www.onlamp.com/pub/a/onlamp/2004/02/05/lamp_tuning.html</a><br />
8. <a href="http://httpd.apache.org/docs/2.2/misc/perf-tuning.html">http://httpd.apache.org/docs/2.2/misc/perf-tuning.html</a><br />
9. Linux Server Hacks by Rob Flickenger</p>
<p><em>Copyright Â© Vishnu Ram 2006</em><br />
<em>Iâ€™m an MTech. in Communication Systems from the IIT Madras. I joined Poornam Info Vision Pvt Ltd. in 2003 and have been working for Poornam since then. My area of interest are performance tuning, server monitoring, and security. In my free time I practice Karate, read books and listen to music.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://9tutorials.com/2007/05/19/configuring-apache-for-maximum-performance.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.htaccess for Webmasters</title>
		<link>http://9tutorials.com/2007/05/12/htaccess-for-webmasters.html</link>
		<comments>http://9tutorials.com/2007/05/12/htaccess-for-webmasters.html#comments</comments>
		<pubDate>Sat, 12 May 2007 07:43:13 +0000</pubDate>
		<dc:creator>dangtruong</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[webmaster]]></category>

		<guid isPermaLink="false">http://9tutorials.com/2007/05/12/htaccess-for-webmasters.html</guid>
		<description><![CDATA[I tried to keep these htaccess code snippets extremely minimalistic.  The focus here is not to explain Apache htaccess or httpd.conf, this is a list of best-practice Apache,htaccess code snippets.

When site is â€œUnder Constructionâ€?
This lets google crawl, lets me access (1.1.1.1) without a password, and lets access from anyone WITH a password. It also [...]]]></description>
			<content:encoded><![CDATA[<div class="spost"><p>I tried to keep these htaccess code snippets extremely minimalistic.  The focus here is not to explain Apache htaccess or httpd.conf, this is a list of best-practice Apache,htaccess code snippets.</p>
<p><span id="more-45"></span></p>
<h3><span class="acd">When site is â€œUnder Constructionâ€?</span></h3>
<p>This lets google crawl, lets me access (1.1.1.1) without a password, and lets access from anyone WITH a password. It also allows for XHTML and CSS validation through <a href="http://www.w3.org/">w3.org</a></p>
<p class="upd"><em>update combined allow code credit: <a href="http://wiki.apache.org/httpd/megaspaz" rel="nofollow">megaspaz</a></em></p>
<pre>AuthName "Under Development"
AuthUserFile /home/askapache.com/.htpasswd
AuthType basic
Require valid-user
Order Deny,Allow
Deny from all
Allow from 1.1.1.1 w3.org googlebot.com google.com google-analytics.com
Satisfy Any</pre>
<h3><span class="acd">Redirect everyone to different site except 1 IP</span></h3>
<pre>ErrorDocument 403 http://www.htaccesselite.com
Order deny,allow
Deny from all
Allow from 1.1.1.1</pre>
<h3><span class="acd">Redirect all but 1 IP to different site, using mod_rewrite</span></h3>
<pre>RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.1.1.1
RewriteRule .* http://www.htaccesselite.com [R=302,L]</pre>
<h3><span class="acd">Redirect Everyone but you to alternate page on your server</span></h3>
<pre>RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.1.1.1
RewriteCond %{REQUEST_URI} !/temporary-offline.html$
RewriteRule .* /temporary-offline.html [R=302,L]</pre>
<h3><span class="acd">Set the Timezone of the server</span></h3>
<pre>SetEnv TZ America/Indianapolis</pre>
<h3><span class="acd">Set the Server Administrator Email</span></h3>
<p>Include a link to your email address in Apache-Generated Error Documents.  Shows up on default Apache error pages</p>
<pre>ServerSignature EMail
SetEnv SERVER_ADMIN spamkill@spamkill.com</pre>
<h3><span class="acd">Turn off the ServerSignature</span></h3>
<p>Turns off the address part of your Server Signature in Apache generated Error Documents.</p>
<pre>ServerSignature Off</pre>
<h3><span class="acd">Force File download, do not display/open in browser</span></h3>
<p>In your HTML directly link to the file.. <code>&lt;a href="/movies/mov1.avi"&gt;Download Movie1&lt;/a&gt;</code>.  Now you will get a pop-up box asking whether you want to save the file or open it.</p>
<pre>AddType application/octet-stream .avi
AddType application/octet-stream .mpg
AddType application/octet-stream .mov
AddType application/octet-stream .pdf</pre>
<h3><span class="acd">Process .gif files with a cgi script</span></h3>
<p>When a user requests a .gif file (image/gif) the server instead of serving that .gif file it serves the results of /cgi-bin/filter.cgi</p>
<pre>Action image/gif /cgi-bin/filter.cgi</pre>
<h3><span class="acd">Process Requests with certain Request Methods</span></h3>
<pre>Script PUT /cgi-bin/upload.cgi
Script HEAD /cgi-bin/head-robot.cgi</pre>
<h3><span class="acd">Make any file be a certain filetype</span></h3>
<p>Makes image.gif, blah.html, index.cgi all act as php</p>
<pre>ForceType application/x-httpd-php</pre>
<h3><span class="acd">Use IfModule for robustness</span></h3>
<p>Basically if the module is found it will perform the code inside the tag.</p>
<pre>&lt;IfModule mod_rewrite.c&gt;
# any mod_rewrite directives here
&lt;/IfModule&gt;
&lt;IfModule mod_expires.c&gt;
# any Expires Directives go here
&lt;/IfModule&gt;
&lt;IfModule mod_headers.c&gt;
# any Header directives go here
&lt;/IfModule&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://9tutorials.com/2007/05/12/htaccess-for-webmasters.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
