<?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>Alunduil&#039;s Hosting &#187; apache</title>
	<atom:link href="http://www.alunduil.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alunduil.com</link>
	<description>Gentoo Hackery and Other Fun ...</description>
	<lastBuildDate>Sun, 01 May 2011 22:00:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Apache Rewrite Cheat Sheet</title>
		<link>http://www.alunduil.com/2011/05/01/apache-rewrite-cheat-sheet/</link>
		<comments>http://www.alunduil.com/2011/05/01/apache-rewrite-cheat-sheet/#comments</comments>
		<pubDate>Sun, 01 May 2011 22:00:34 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Linux Guides]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[rewritecond]]></category>
		<category><![CDATA[rewritelog]]></category>
		<category><![CDATA[rewriteloglevel]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=410</guid>
		<description><![CDATA[Introduction I was recently requested to document common apache rewrite pitfalls and examples and crafted the following document as a response.  It is intended as a two page document (Rewrite Cheat Sheet) where the first page is a reference guide of commonly used rewrite variables and flags and the second page is a short list of <a href='http://www.alunduil.com/2011/05/01/apache-rewrite-cheat-sheet/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 0.79in } 		P { margin-bottom: 0.08in } 		P.western { font-size: 10pt } 		P.cjk { font-size: 10pt } 		H1 { margin-bottom: 0.08in } 		H1.western { font-family: "Liberation Sans", sans-serif; font-size: 15pt } 		H1.cjk { font-family: "DejaVu Sans"; font-size: 16pt } 		H1.ctl { font-family: "DejaVu Sans"; font-size: 16pt } 		H2 { margin-bottom: 0.08in } 		H2.western { font-family: "Liberation Sans", sans-serif; font-size: 12pt; font-style: italic } 		H2.cjk { font-size: 14pt; font-style: italic; font-weight: normal } 		H2.ctl { font-size: 14pt; font-style: italic; font-weight: normal } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "Liberation Sans", sans-serif; font-size: 12pt } 		CODE.cjk { font-family: "DejaVu Sans", monospace } --></p>
<h1>Introduction</h1>
<p>I was recently requested to document common apache rewrite pitfalls and examples and crafted the following document as a response.  It is intended as a two page document (<a href="http://www.alunduil.com/wp-content/uploads/2011/04/Rewrite-Cheat-Sheet.pdf">Rewrite Cheat Sheet</a>) where the first page is a reference guide of commonly used rewrite variables and flags and the second page is a short list of examples, gotchas, and troubleshooting advice.</p>
<h1>Rewrite Cheat Sheet</h1>
<h2>Common Variables</h2>
<h3>HTTP Headers</h3>
<ul>
<li>HTTP_USER_AGENT</li>
<li>HTTP_REFERER</li>
<li>HTTP_COOKIE</li>
<li>HTTP_FORWARDED</li>
<li>HTTP_HOST</li>
<li>HTTP_PROXY_CONNECTION</li>
<li>HTTP_ACCEPT</li>
</ul>
<h3>connection &amp; request</h3>
<ul>
<li>REMOTE_ADDR</li>
<li>REMOTE_HOST</li>
<li>REMOTE_PORT</li>
<li>REMOTE_USER</li>
<li>REMOTE_IDENT</li>
<li>REQUEST_METHOD</li>
<li>SCRIPT_FILENAME</li>
<li>PATH_INFO</li>
<li>QUERY_STRING</li>
<li>AUTH_TYPE</li>
</ul>
<h3>server internals</h3>
<ul>
<li>DOCUMENT_ROOT</li>
<li>SERVER_ADMIN</li>
<li>SERVER_NAME</li>
<li>SERVER_ADDR</li>
<li>SERVER_PORT</li>
<li>SERVER_PROTOCOL</li>
<li>SERVER_SOFTWARE</li>
</ul>
<h3>date and time</h3>
<ul>
<li>TIME_YEAR</li>
<li>TIME_MON</li>
<li>TIME_DAY</li>
<li>TIME_HOUR</li>
<li>TIME_MIN</li>
<li>TIME_SEC</li>
<li>TIME_WDAY</li>
<li>TIME</li>
</ul>
<h3>specials</h3>
<ul>
<li>API_VERSION</li>
<li>THE_REQUEST</li>
<li>REQUEST_URI</li>
<li>REQUEST_FILENAME</li>
<li>IS_SUBREQ</li>
<li>HTTPS</li>
</ul>
<h2>Variable Descriptions</h2>
<ul>
<li><code>REQUEST_FILENAME</code>
<ul>
<li>The full local filesystem path to the file 		or script matching the request, if this has already been determined 		by the server at the time <code>REQUEST_FILENAME</code> is referenced. Otherwise, such as when used in virtual host 		context, the same value as <code>REQUEST_URI</code>.</li>
</ul>
</li>
<li><code>HTTPS</code>
<ul>
<li>Will contain the text &#8220;on&#8221; if the 		connection is using SSL/TLS, or &#8220;off&#8221; otherwise. (This 		variable can be safely used regardless of whether or not <code>mod_ssl</code> is loaded).</li>
</ul>
</li>
</ul>
<h2>Flag Descriptions</h2>
<ul>
<li>&#8216;<code>nocase|NC</code>&#8216; (<strong>n</strong>o 	<strong>c</strong>ase) :: This makes the test case-insensitive &#8211; 	differences between &#8216;A-Z&#8217; and &#8216;a-z&#8217; are ignored, both in the 	expanded <em>TestString</em> and the <em>CondPattern</em>.</li>
<li>&#8216;<code>ornext|OR</code>&#8216; (<strong>or</strong> next condition) (<strong>RewriteCond Only</strong>) :: Use this to combine 	rule conditions with a local OR instead of the implicit AND.</li>
<li><strong>&#8216;last|L&#8217;</strong> :: Stop the rewriting 	process immediately and don&#8217;t apply any more rules.</li>
<li><strong>&#8216;proxy|P&#8217;</strong> :: Force the substitution 	URL to be internally sent as a proxy request.</li>
<li><em><strong>&#8216;qsappend|QSA</strong></em><em>&#8216;</em><em> :: Appends any query string created in the rewrite target to any 	query string that was in the original request URL.</em></li>
<li><em>&#8216;</em><em><strong>redirect|R[=code]</strong></em><em>&#8216; 	:: </em><em>Forces an external redirect, optionally with the 	specified HTTP status code.</em></li>
<li><em>&#8216;</em><em><strong>forbidden|F</strong></em><em>&#8216;</em><em> :: Returns a 403 FORBIDDEN response to the client browser.</em></li>
</ul>
<h2>Good Examples</h2>
<ul>
<li>Adding www to all requests
<ul>
<li>RewriteCond %{HTTP_HOST} !^www [NC]</li>
<li>RewriteRule ^ 		http://www.%{HTTP_HOST}%{REQUEST_URI} [R,L,QSA]</li>
</ul>
</li>
<li>Forcing all requests to HTTPS
<ul>
<li>RewriteCond %{HTTPS} off</li>
<li>RewriteRule ^ 		https://%{HTTP_HOST}%{REQUEST_URI} [R,L,QSA]</li>
</ul>
</li>
<li>Redirect a specific subweb to another domain
<ul>
<li>RewriteRule ^/?subweb/(.*) 		http://other.example.com/$1 [R,L,QSA]</li>
</ul>
</li>
<li>Block specific IPs from access
<ul>
<li>RewriteCond %{REMOTE_ADDR} ^127\.0\.0</li>
<li>RewriteRule ^ &#8211; [F,L]</li>
</ul>
</li>
<li>Creating a filesystem alias with modrewrite
<ul>
<li>RewriteRule ^/?alias/(.*) 		/var/www/vhosts/$1/httpdocs/$1 [L,R]</li>
</ul>
</li>
<li>A condition to stop CMS software from 	over-riding fullstatus (added before the offending rewriterule)
<ul>
<li>RewriteCond ${REQUEST_URI} !server-status 		[NC]</li>
</ul>
</li>
</ul>
<h2>Bad Examples</h2>
<ul>
<li>Recursive rewrite
<ul>
<li>RewriteRule ^ 		http://www.%{HTTP_HOST}%{REQUEST_URI} [R,L,QSA]</li>
</ul>
</li>
</ul>
<h2>Gotchas</h2>
<ul>
<li>Some rewrites may conflict with existing 	rewrites provided by many CMS packages (wordpress, drupal, joomla, 	etc).  Check for any existing rewrites in a .htaccess file.</li>
<li>Rewriterule and rewritecond can only be used 	in the following contexts: server config, virtual host, directory, 	.htaccess</li>
</ul>
<h2>Common Troubleshooting</h2>
<ul>
<li>Enable the rewrite logs with RewriteLog and 	RewriteLevel
<ul>
<li>RewriteLog &lt;file path&gt;</li>
<li>RewriteLogLevel 3 # ranges from 0 to 9</li>
</ul>
</li>
<li>Check your regular expressions against a PCRE 	checker (they are very bountiful on the Internet 	[http://tinyurl.com/3hop7xu]).</li>
<li>Utilize curl to test redirects (R), `curl -I 	example.com`</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2011/05/01/apache-rewrite-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Memcached Remote Memory Sharing</title>
		<link>http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/</link>
		<comments>http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 22:15:03 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Linux Guides]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=150</guid>
		<description><![CDATA[Introduction Memcached is a simple key/value memory store that allows values from pretty much any application to be stored in memory for quick retrieval. Most languages have simple APIs that make this very easy from a programming standpoint. This also means that it&#8217;s not quite as simple to configure as APC (but similar for modern <a href='http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Introduction</h1>
<p>Memcached is a simple key/value memory store that allows values from pretty much any application to be stored in memory for quick retrieval.  Most languages have simple APIs that make this very easy from a programming standpoint.  This also means that it&#8217;s not quite as simple to <a href="http://www.alunduil.com/2010/05/26/apc-caching-php/">configure as APC</a> (but similar for modern applications).</p>
<h1>Installation and Configuration</h1>
<p>To install memcached I recommend using your choice of installation (mine being emerge) and then checking the configuration (again in the case of Gentoo) located at /etc/conf.d/memcached.</p>
<p>Update the file to listen on the interface you want, use the memory you want, etc and then start the daemon up.  Now if you&#8217;re using memcached on the same server as your apache server most webapps will be able to just turn on memcached and connect and work, but if you&#8217;re using memcached and apache on separate servers it&#8217;s a little more work.</p>
<h1>WordPress and memcached</h1>
<p>I&#8217;ve already touted the wordpress plugin: <a href="http://www.w3-edge.com/wordpress-plugins/w3-total-cache/">W3 Total Cache</a> but unfortunately this plugin doesn&#8217;t allow you to easily configure memcached usage through the web interface.  It defaults to using the memcached server located at 127.0.0.1:11211 which if we&#8217;re using separate servers is less than ideal.  The file we need to modify with a simply sed (or by hand if you prefer knowing what&#8217;s going on) is %{DOCROOT}/wp-content/w3-total-cache-config.php.</p>
<p>We just need to change the memcached servers to point at our server&#8217;s location before enabling it in the interface.  To easily accomplish this we can use sed:</p>
<p>sed -i -e &#8216;s/127.0.0.1:11211/: /g&#8217; %{DOCROOT}/wp-content/w3-total-cache-config.php</p>
<h1>Mediawiki and memcached</h1>
<p>The other application we can easily setup for memcached is mediawiki.  Mediawiki wants us to modify its LocalSettings.php with the following additions:</p>
<p>## Shared memory settings<br />
$wgMainCacheType = CACHE_MEMCACHED;<br />
$wgParserCacheType = CACHE_MEMCACHED;<br />
$wgMessageCacheType = CACHE_MEMCACHED;<br />
$wgMemCachedServers = array(&#8220;giskard.alunduil.com:11211&#8243;);</p>
<p>$wgSessionsInMemcached = true;</p>
<p>These settings simply turn on memcached (CACHE_MEMCACHED) for the various caching areas that mediawiki uses and specifies an array of memcached servers to store that caching information in.</p>
<p>If you do have more than one memcached server configured and available you can use the following syntax to include all of them with various weights:</p>
<p>$wgMemCachedServers = array(array(&#8220;host:port&#8221;, weight), array(&#8220;host2:port2&#8243;, weight));</p>
<h1>Conclusion</h1>
<p>Using memcached can greatly improve the performance of webapps or other applications that don&#8217;t need to present the most up to date information.  This can reduce traffic to an overloaded database or configuration file or whatever other store you want to place a cache in front of.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2010/06/24/memcached-remote-memory-sharing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optimizing the AM out of LAMP</title>
		<link>http://www.alunduil.com/2010/05/23/optimizing-the-am-out-of-lamp/</link>
		<comments>http://www.alunduil.com/2010/05/23/optimizing-the-am-out-of-lamp/#comments</comments>
		<pubDate>Mon, 24 May 2010 02:22:34 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Linux Guides]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[efficiency]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=127</guid>
		<description><![CDATA[A hot topic for anyone running MySQL and Apache on any machine is optimization and I hope to quickly explain how to optimize MySQL and where to tweak Apache to help with it&#8217;s operational efficiency as well. First things first &#8230; A few common things to possibly turn on, install, or enable: APC (Another PHP <a href='http://www.alunduil.com/2010/05/23/optimizing-the-am-out-of-lamp/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>A hot topic for anyone running MySQL and Apache on any machine is optimization and I hope to quickly explain how to optimize MySQL and where to tweak Apache to help with it&#8217;s operational efficiency as well.</p>
<h1>First things first &#8230;</h1>
<p>A few common things to possibly turn on, install, or enable:</p>
<ul>
<li>APC (Another PHP Cache)</li>
<li>Memcached</li>
</ul>
<h1>MySQL Optimization</h1>
<p>The easiest way (and the quickest) to determine what can be done to optimize MySQL is to use a script called mysqltuner.pl.  The really interesting thing about this script is that to get it you simply run the following:</p>
<p>wget mysqltuner.pl</p>
<p>After you&#8217;ve gotten this script run it with your perl interpreter:</p>
<p>perl mysqltuner.pl</p>
<p>It will prompt you for your username and password for mysql and then print out a nice report outlining how your mysql daemon has been running.  Here&#8217;s an example of this output:</p>
<p>&gt;&gt;  MySQLTuner 1.0.1 &#8211; Major Hayden<br />
&gt;&gt;  Bug reports, feature requests, and downloads at http://mysqltuner.com/<br />
&gt;&gt;  Run with &#8216;&#8211;help&#8217; for additional options and output filtering<br />
Please enter your MySQL administrative login: root<br />
Please enter your MySQL administrative password:</p>
<p>&#8212;&#8212;&#8211; General Statistics &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[--] Skipped version check for MySQLTuner script<br />
[OK] Currently running supported MySQL version 5.0.90-log<br />
[OK] Operating on 32-bit architecture with less than 2GB RAM</p>
<p>&#8212;&#8212;&#8211; Storage Engine Statistics &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster<br />
[--] Data in MyISAM tables: 28M (Tables: 96)<br />
[--] Data in InnoDB tables: 1M (Tables: 55)<br />
[!!] Total fragmented tables: 2</p>
<p>&#8212;&#8212;&#8211; Performance Metrics &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
[--] Up for: 1h 39m 49s (24K q [4.163 qps], 354 conn, TX: 9M, RX: 34M)<br />
[--] Reads / Writes: 60% / 40%<br />
[--] Total buffers: 148.6M global + 960.0K per thread (100 max threads)<br />
[OK] Maximum possible memory usage: 242.3M (11% of installed RAM)<br />
[OK] Slow queries: 0% (0/24K)<br />
[OK] Highest usage of available connections: 28% (28/100)<br />
[OK] Key buffer size / total MyISAM indexes: 64.0K/6.3M<br />
[OK] Key buffer hit rate: 99.6% (164K cached / 682 reads)<br />
[OK] Query cache efficiency: 81.3% (14K cached / 17K selects)<br />
[OK] Query cache prunes per day: 0<br />
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 463 sorts)<br />
[!!] Joins performed without indexes: 42<br />
[OK] Temporary tables created on disk: 12% (54 on disk / 417 total)<br />
[OK] Thread cache hit rate: 70% (106 created / 354 connections)<br />
[!!] Table cache hit rate: 2% (48 open / 2K opened)<br />
[OK] Open file limit used: 9% (95/1K)<br />
[OK] Table locks acquired immediately: 98% (7K immediate / 7K locks)<br />
[!!] Connections aborted: 7%<br />
[OK] InnoDB data size / buffer pool: 1.0M/4.0M</p>
<p>&#8212;&#8212;&#8211; Recommendations &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
General recommendations:<br />
Run OPTIMIZE TABLE to defragment tables for better performance<br />
MySQL started within last 24 hours &#8211; recommendations may be inaccurate<br />
Adjust your join queries to always utilize indexes<br />
Increase table_cache gradually to avoid file descriptor limits<br />
Your applications are not closing MySQL connections properly<br />
Variables to adjust:<br />
join_buffer_size (&gt; 128.0K, or always use indexes with joins)<br />
table_cache (&gt; 48)</p>
<p>The first thing to notice is that mysql should be running for 24 to 48 hours before you trust the results of this script. The second thing to acknowledge is that it isn&#8217;t omniscient.  Understanding how these parameters affect your memory footprint and your runtime efficiency are what we&#8217;re most interested in though.</p>
<h1>Glossary of Parameters</h1>
<p>The best source of my.cnf parameters is of course the MySQL documentation, but I&#8217;ll clarify a few of the more pertinent items from the above output.</p>
<ul>
<li>Maximum Possible Memory &#8211; This is not the actual hard limit on your memory usage but a calculated theoretical maximum based on the parameters in your my.cnf and if this is over ~90% you may use your swap more than you want to.  After making any changes I suggest you check this to make sure you haven&#8217;t over-allocated yourself.</li>
<li>Highest Usage of Available Connections &#8211; This is the historical max connections used by mysql and if it&#8217;s at 100% this isn&#8217;t a guarantee that you need to increase max_connections but may just indicate that your connections spiked once.  That being said I recommend following its advice if you have the memory for it.</li>
<li>Query Cache Efficiency &#8211; The hit rate for the cache on your queries (I hope you have enabled).  As with any hash table if you&#8217;re not hitting what&#8217;s in the top bucket you need to increase the number of buckets.</li>
<li>Temporary Tables Created on Disk &#8211; This can be a finicky parameter to get right and is the first place I would recommend cutting if you don&#8217;t have the memory to run mysql like you would want, but if you do have the memory then up this as far as you can within reason.</li>
<li>Thread Cache Hit Rate &#8211; Just like any other cache.</li>
<li>Table Cache Hit Rate &#8211; Just like any other cache.</li>
</ul>
<h1>Fragmented Tables</h1>
<p>If you noticed the fragmented tables along with the recommendation to run OPTIMIZE TABLE that&#8217;s not something that will typically slow mysql down noticeably with today&#8217;s disks, but if you want to defragment them I recommend reading <a href="http://www.dufault.info/blog/a-script-to-optimize-fragmented-tables-in-mysql/">this article on the topic</a>.</p>
<h1>Apache Tweaking</h1>
<p>The following parameters are usually in httpd.conf unless you run a distribution that organizes apache in an easier to work with manner (my preference of course is Gentoo which stores these parameters in: 00_mpm.conf).</p>
<p>The parameters for tweaking apache&#8217;s processes depend on which worker module you have in use.  The following is the pertinent sections from my configuration:</p>
<p>#prefork MPM<br />
# This is the default MPM if USE=-threads<br />
#<br />
# MinSpareServers: Minimum number of idle child server processes<br />
# MaxSpareServers: Maximum number of idle child server processes</p>
<p>StartServers            5<br />
MinSpareServers         5<br />
MaxSpareServers         10<br />
MaxClients                      50<br />
MaxRequestsPerChild     500</p>
<p># worker MPM<br />
# This is the default MPM if USE=threads<br />
#<br />
# MinSpareThreads: Minimum number of idle threads available to handle request spikes<br />
# MaxSpareThreads: Maximum number of idle threads<br />
# ThreadsPerChild: Number of threads created by each child process</p>
<p>StartServers            2<br />
MinSpareThreads         15<br />
MaxSpareThreads         50<br />
ThreadsPerChild         25<br />
MaxClients                      150<br />
MaxRequestsPerChild     1000</p>
<p>These parameters are pretty self explanatory but just for completeness&#8217; sake I&#8217;ll do a small recap on these here:</p>
<p>* StartServers &#8211; The number of servers to have running and handling connections at first launch.<br />
* MinSpareServers &#8211; The minimum number of servers to have running not currently handling connections.<br />
* MaxSpareServers &#8211; The maximum number of servers to have running not currently handling connections.<br />
* MaxClients &#8211; The maximum number of clients that can simultaneously connect to Apache.<br />
* MaxRequestsPerChild &#8211; The maximum number of requests that a child will respond to before terminating.</p>
<p>Using these parameters we can control the amount of memory that Apache will consume at the cost of other things we may want to have like lots of connections or many sequential requests.</p>
<h1>Conclusion</h1>
<p>There are a lot of different things that can be done for a server that seems to be performing less than ideally and I&#8217;ve only covered a fraction of things that can happen.  As always with this topic the situation will change based on your needs and how your server runs, but at least now you may have a starting point for what to modify after you&#8217;ve troubleshooted every other thing that could go wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2010/05/23/optimizing-the-am-out-of-lamp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Running awstats on Gentoo</title>
		<link>http://www.alunduil.com/2010/03/02/running-awstats-on-gentoo/</link>
		<comments>http://www.alunduil.com/2010/03/02/running-awstats-on-gentoo/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 16:31:40 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Linux Guides]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=102</guid>
		<description><![CDATA[Requirements I&#8217;m assuming for this quick guide that you already have a website installed and consequently apache. emerge -av awstats A quick breakdown on the use flags from gentookit&#8217;s equery: apache2 : Add Apache2 support geoip : Add geoip support for country and city lookup based on IPs vhosts : Adds support for installing web-based <a href='http://www.alunduil.com/2010/03/02/running-awstats-on-gentoo/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<h1>Requirements</h1>
<p>I&#8217;m assuming for this quick guide that you already have a website installed and consequently apache.</p>
<p>emerge -av awstats</p>
<p>A quick breakdown on the use flags from gentookit&#8217;s equery:</p>
<ul>
<li>apache2 : Add Apache2 support</li>
<li>geoip   : Add geoip support for country and city lookup based on IPs</li>
<li>vhosts  : Adds support for installing web-based applications into a virtual-hosting environment</li>
</ul>
<h1><strong>Configuration</strong></h1>
<p>Lots of configuration needs to occur for awstats to work correctly:</p>
<p>First, we need to setup a configuration file for the web site so we can update the statistics.<br />
cp /etc/awstats/awstats.model.conf /etc/awstats/awstats..conf</p>
<p>Where fqdn is the fully qualified domain name of your website you&#8217;ll be monitoriing.  After you&#8217;ve copied the default configuration customize it for your particular website.</p>
<p>Second, you need to enable awstats in your apache vhost configuration:</p>
<p>CustomLog /var/www/localhost/log/apache/production.log combined</p>
<p>Alias /awstats/classes &#8220;/usr/share/webapps/awstats/6.9-r1/htdocs/classes/&#8221;<br />
Alias /awstats/css &#8220;/usr/share/webapps/awstats/6.9-r1/htdocs/css/&#8221;<br />
Alias /awstats/icons &#8220;/usr/share/webapps/awstats/6.9-r1/htdocs/icon/&#8221;<br />
ScriptAlias /awstats/ &#8220;/usr/share/webapps/awstats/6.9-r1/hostroot/cgi-bin/&#8221;<br />
ScriptAlias /awstats &#8220;/usr/share/webapps/awstats/6.9-r1/hostroot/cgi-bin/awstats.pl&#8221;<br />
ScriptAlias /awstats.pl &#8220;/usr/share/webapps/awstats/6.9-r1/hostroot/cgi-bin/awstats.pl&#8221;<br />
Options None<br />
AllowOverride None</p>
<p>Order allow,deny<br />
Allow from all</p>
<p>Options ExecCGI<br />
AllowOverride None</p>
<p>Order allow,deny<br />
Allow from all</p>
<p>Options None<br />
AllowOverride None<br />
Order allow,deny<br />
Allow from all<br />
Options None<br />
AllowOverride None<br />
Order allow,deny<br />
Allow from all</p>
<p>And verify the logging output in /etc/apache2/modules.d/00_mod_log_config.conf:<br />
# The following directives define some format nicknames for use with<br />
# a CustomLog directive (see below).<br />
LogFormat &#8220;%h %l %u %t \&#8221;%r\&#8221; %&gt;s %b \&#8221;%{Referer}i\&#8221; \&#8221;%{User-Agent}i\&#8221;" combined<br />
LogFormat &#8220;%h %l %u %t \&#8221;%r\&#8221; %&gt;s %b&#8221; common</p>
<p>LogFormat &#8220;%{Referer}i -&gt; %U&#8221; referer<br />
LogFormat &#8220;%{User-Agent}i&#8221; agent<br />
LogFormat &#8220;%v %h %l %u %t \&#8221;%r\&#8221; %&gt;s %b %T&#8221; script<br />
LogFormat &#8220;%v %h %l %u %t \&#8221;%r\&#8221; %&gt;s %b \&#8221;%{Referer}i\&#8221; \&#8221;%{User-Agent}i\&#8221; VLOG=%{VLOG}e&#8221; vhost<br />
# You need to enable mod_logio.c to use %I and %O<br />
LogFormat &#8220;%h %l %u %t \&#8221;%r\&#8221; %&gt;s %b \&#8221;%{Referer}i\&#8221; \&#8221;%{User-Agent}i\&#8221; %I %O&#8221; combinedio<br />
LogFormat &#8220;%v %h %l %u %t \&#8221;%r\&#8221; %&gt;s %b \&#8221;%{Referer}i\&#8221; \&#8221;%{User-Agent}i\&#8221; %I %O&#8221; vhostio</p>
<p># The location and format of the access logfile (Common Logfile Format).<br />
# If you do not define any access logfiles within a<br />
# container, they will be logged here.  Contrariwise, if you *do*<br />
# define per- access logfiles, transactions will be<br />
# logged therein and *not* in this file.<br />
CustomLog /var/log/apache2/access_log common</p>
<p># If you would like to have agent and referer logfiles,<br />
# uncomment the following directives.<br />
#CustomLog /var/log/apache2/referer_log referer<br />
#CustomLog /var/log/apache2/agent_logs agent</p>
<p># If you prefer a logfile with access, agent, and referer information<br />
# (Combined Logfile Format) you can use the following directive.<br />
#CustomLog /var/log/apache2/access_log combined</p>
<p>And Lastly, you need to add a cron entry to update the statistics on a regular basis:<br />
# AWStats<br />
*/15 * * * * perl /usr/share/webapps/awstats/6.9-r1/hostroot/cgi-bin/awstats.pl -config=www.alunduil.com -update &gt; /dev/null</p>
<p>Everything should be running smoothly but give your installation some time to begin collecting statistics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2010/03/02/running-awstats-on-gentoo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Mother System Load</title>
		<link>http://www.alunduil.com/2010/01/20/80/</link>
		<comments>http://www.alunduil.com/2010/01/20/80/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 21:39:50 +0000</pubDate>
		<dc:creator>Alex Brandt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[ridiculous]]></category>
		<category><![CDATA[sysload]]></category>
		<category><![CDATA[uptime]]></category>

		<guid isPermaLink="false">http://www.alunduil.com/?p=80</guid>
		<description><![CDATA[Today I found out that some machines can&#8217;t handle the load I throw at them. The following was the status of my web server after apache filled up its memory. A quick (quite slow actually) reboot of apache and everything was stabilized. !Ridiculous System Load]]></description>
			<content:encoded><![CDATA[<p>Today I found out that some machines can&#8217;t handle the load I throw at them.  The following was the status of my web server after apache filled up its memory.  A quick (quite slow actually) reboot of apache and everything was stabilized.</p>
<p>!<a href="http://www.alunduil.com/wp-content/uploads/2010/01/holy-shit.png">Ridiculous System Load</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alunduil.com/2010/01/20/80/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached (User agent is rejected)
Database Caching 4/10 queries in 0.011 seconds using memcached
Object Caching 449/463 objects using memcached

Served from: www.alunduil.com @ 2012-02-06 09:25:07 -->
