<?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>Jetpack Flight Log &#187; apache</title>
	<atom:link href="http://jetpackweb.com/blog/topics/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://jetpackweb.com/blog</link>
	<description>Rock{et}ing the interweb</description>
	<lastBuildDate>Wed, 19 May 2010 22:21:53 +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>Munin Graphs for Phusion Passenger (a.k.a. mod_rails)</title>
		<link>http://jetpackweb.com/blog/2009/09/29/munin-graphs-for-phusion-passenger-a-k-a-mod_rails/</link>
		<comments>http://jetpackweb.com/blog/2009/09/29/munin-graphs-for-phusion-passenger-a-k-a-mod_rails/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 16:54:05 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=408</guid>
		<description><![CDATA[The goal of this article is to get fairly nice looking graphs of Phusion Passenger&#8217;s performance and memory metrics: This specific setup focuses on CentOS (on cPanel none the less) &#8211; but instructions should apply for most linux distros. It assumes you already have Passenger and Munin successfully setup. See my previous article on getting [...]]]></description>
			<content:encoded><![CDATA[<p>The goal of this article is to get fairly nice looking graphs of <a href="http://www.modrails.com/" target="_blank">Phusion Passenger&#8217;s</a> performance and memory metrics:</p>
<p><img src="http://jetpackweb.com/blog/wp-content/uploads/2009/09/passenger_memory_stats.png" /><br />
<img src="http://jetpackweb.com/blog/wp-content/uploads/2009/09/passenger_status.png" /></p>
<p>This specific setup focuses on CentOS (on cPanel none the less) &#8211; but instructions should apply for most linux distros. It assumes you already have Passenger and Munin successfully setup. See my <a href="http://jetpackweb.com/blog/2009/07/21/install-phusion-passenger-a-k-a-mod_rails-on-cpanel-server/">previous article</a> on getting Phusion Passenger setup if you have not already. </p>
<p>First we need to allow the <strong>munin</strong> user sudo privileges for a few passenger related commands:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;">$ <span class="kw2">sudo</span> <span class="sy0">/</span>usr<span class="sy0">/</span>sbin<span class="sy0">/</span>visudo
&nbsp;
<span class="co0"># Add the following line to the file</span>
munin <span class="re2">ALL</span>=<span class="br0">&#40;</span>ALL<span class="br0">&#41;</span> NOPASSWD:<span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>passenger-status, <span class="sy0">/</span>usr<span class="sy0">/</span>bin<span class="sy0">/</span>passenger-memory-stats
&nbsp;
<span class="co0"># Depending on your setup, you may also have to comment out the following line:</span>
Defaults requiretty</pre></div></div>

<p>If you see the error <strong>sorry, you must have a tty to run sudo</strong> in <strong>/var/log/munin/munin-node.log</strong>, comment out the final line shown above.</p>
<p>The following two files will glean some performance and memory statistics.</p>
<p><strong>Passenger Status:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco, monospace;"><span class="co1">#!/usr/bin/env ruby</span>
&nbsp;
<span class="kw1">def</span> output_config
  <span class="kw3">puts</span> <span class="sy0">&lt;&lt;-</span><span class="kw1">END</span>
graph_category App
graph_title passenger status
graph_vlabel count
&nbsp;
sessions.<span class="me1">label</span> sessions
max.<span class="me1">label</span> max processes
running.<span class="me1">label</span> running processes
active.<span class="me1">label</span> active processes
<span class="kw1">END</span>
  <span class="kw3">exit</span> <span class="nu0">0</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">def</span> output_values
  status = <span class="st0">`sudo /usr/bin/passenger-status`</span>
  <span class="kw1">unless</span> $?.<span class="me1">success</span>?
    <span class="re0">$stderr</span>.<span class="kw3">puts</span> <span class="st0">&quot;failed executing passenger-status&quot;</span>
    <span class="kw3">exit</span> <span class="nu0">1</span>
  <span class="kw1">end</span>
  status =~ <span class="sy0">/</span>max\s<span class="sy0">+</span>=\s<span class="sy0">+</span><span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;max.value #{$1}&quot;</span>
&nbsp;
  status =~ <span class="sy0">/</span>count\s<span class="sy0">+</span>=\s<span class="sy0">+</span><span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;running.value #{$1}&quot;</span>
&nbsp;
  status =~ <span class="sy0">/</span>active\s<span class="sy0">+</span>=\s<span class="sy0">+</span><span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;active.value #{$1}&quot;</span>
&nbsp;
  total_sessions = <span class="nu0">0</span>
  status.<span class="me1">scan</span><span class="br0">&#40;</span><span class="sy0">/</span>Sessions: <span class="br0">&#40;</span>\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span><span class="br0">&#41;</span>.<span class="me1">flatten</span>.<span class="me1">each</span> <span class="br0">&#123;</span> <span class="sy0">|</span>count<span class="sy0">|</span> total_sessions <span class="sy0">+</span>= count.<span class="me1">to_i</span> <span class="br0">&#125;</span>
  <span class="kw3">puts</span> <span class="st0">&quot;sessions.value #{total_sessions}&quot;</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">if</span> ARGV<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> == <span class="st0">&quot;config&quot;</span>
  output_config
<span class="kw1">else</span>
  output_values
<span class="kw1">end</span></pre></div></div>

<p><strong>Memory Stats:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco, monospace;"><span class="co1">#!/usr/bin/env ruby</span>
<span class="co1"># put in /etc/munin/plugins and restart munin-node</span>
<span class="co1"># by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin</span>
<span class="co1"># NOTE: you might need to add munin to allow passwordless sudo for passenger-memory-stats</span>
&nbsp;
<span class="kw1">def</span> output_config
  <span class="kw3">puts</span> <span class="sy0">&lt;&lt;-</span><span class="kw1">END</span>
graph_category App
graph_title Passenger memory stats
graph_vlabel count
&nbsp;
memory.<span class="me1">label</span> memory
<span class="kw1">END</span>
  <span class="kw3">exit</span> <span class="nu0">0</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">def</span> output_values
  status = <span class="st0">`sudo /usr/bin/passenger-memory-stats | tail -1`</span>
  <span class="kw1">unless</span> $?.<span class="me1">success</span>?
    <span class="re0">$stderr</span>.<span class="kw3">puts</span> <span class="st0">&quot;failed executing passenger-memory-stats&quot;</span>
    <span class="kw3">exit</span> <span class="nu0">1</span>
  <span class="kw1">end</span>
  status =~ <span class="sy0">/</span><span class="br0">&#40;</span>\d<span class="sy0">+</span>\.\d<span class="sy0">+</span><span class="br0">&#41;</span><span class="sy0">/</span>
  <span class="kw3">puts</span> <span class="st0">&quot;memory.value #{$1}&quot;</span>
<span class="kw1">end</span>
&nbsp;
<span class="kw1">if</span> ARGV<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> == <span class="st0">&quot;config&quot;</span>
  output_config
<span class="kw1">else</span>
  output_values
<span class="kw1">end</span></pre></div></div>

<p>Now we will link these to the active plugins, and make them executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">chmod</span> +x <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status
<span class="kw2">sudo</span> <span class="kw2">chmod</span> +x <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status
<span class="kw2">sudo</span> <span class="kw2">ln</span> <span class="re5">-s</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_status
<span class="kw2">sudo</span> <span class="kw2">ln</span> <span class="re5">-s</span> <span class="sy0">/</span>usr<span class="sy0">/</span>share<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugins<span class="sy0">/</span>passenger_memory_status</pre></div></div>

<p>Last thing we need to do is make sure those scripts run as the munin user:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="kw2">vi</span> <span class="sy0">/</span>etc<span class="sy0">/</span>munin<span class="sy0">/</span>plugin-conf.d<span class="sy0">/</span>munin-node</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="br0">&#91;</span>passenger_<span class="sy0">*</span><span class="br0">&#93;</span>
user munin
<span class="kw3">command</span> ruby <span class="sy0">%</span>c</pre></div></div>

<p>Restart the munin node, and wait and you should see the graphs start to propagate.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>munin-node restart</pre></div></div>

<p>For even more detailed performance analytics, checkout <a href="http://www.newrelic.com/" target="_blank">NewRelic</a> monitoring. And thanks to <a href="http://www.dcmanges.com/blog/rails-application-visualization-with-munin" target="_blank">Dan Mange</a> for the munin scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/09/29/munin-graphs-for-phusion-passenger-a-k-a-mod_rails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Clean Webalizer Referrer Stats in cPanel</title>
		<link>http://jetpackweb.com/blog/2009/09/21/clean-webalizer-referrer-stats-in-cpanel/</link>
		<comments>http://jetpackweb.com/blog/2009/09/21/clean-webalizer-referrer-stats-in-cpanel/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:35:42 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[cpanel]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=394</guid>
		<description><![CDATA[I find it useful to override some of cPanel&#8217;s default webalizer configurations. There can be a lot of misleading or unnecessary data when you don&#8217;t ignore traffic that is being referred to from your own site. Create the following file: vi /home/username/tmp/webalizer/webalizer.conf HideSite *example.com HideSite localhost HideReferrer example.com/ MangleAgents 4 &#160; TopSites 10 TopKSites 10 [...]]]></description>
			<content:encoded><![CDATA[<p>I find it useful to override some of cPanel&#8217;s default webalizer configurations. There can be a lot of misleading or unnecessary data when you don&#8217;t ignore traffic that is being referred to from your own site.</p>
<p>Create the following file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">vi</span> <span class="sy0">/</span>home<span class="sy0">/</span>username<span class="sy0">/</span>tmp<span class="sy0">/</span>webalizer<span class="sy0">/</span>webalizer.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family: Monaco, monospace;">HideSite *example.com
HideSite localhost
HideReferrer example.com/
MangleAgents 4
&nbsp;
TopSites        10
TopKSites       10
TopURLs         10
TopKURLs        50
TopReferrers    250
TopAgents       15
TopCountries    10
TopEntry        10
TopExit         10
TopSearch       20
TopUsers        20
&nbsp;
# Usually you want to hide these
HideURL         *.gif
HideURL         *.GIF
HideURL         *.jpg
HideURL         *.JPG
HideURL         *.png
HideURL         *.PNG
HideURL         *.bmp
HideURL         *.BMP</pre></div></div>

<p>Replace <strong>example.com</strong> with the domain you are working on. The next time webalizer runs it will not be clogged with useless referrers generated by your site. To force webalizer to run(in a cPanel environment), execute:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="sy0">/</span>scripts<span class="sy0">/</span>runweblogs username</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/09/21/clean-webalizer-referrer-stats-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Office 2007 docx, pptx, and xslx saving as zip files</title>
		<link>http://jetpackweb.com/blog/2009/08/12/office-2007-docx-pptx-and-xslx-saving-as-zip-files/</link>
		<comments>http://jetpackweb.com/blog/2009/08/12/office-2007-docx-pptx-and-xslx-saving-as-zip-files/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 19:57:07 +0000</pubDate>
		<dc:creator>Brian Racer</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[office 2007]]></category>

		<guid isPermaLink="false">http://jetpackweb.com/blog/?p=238</guid>
		<description><![CDATA[Recently I had an issue where various browsers on Windows desktops were saving docx, xslx, and pptx as zip files when downloaded from our linux web servers(apache in this case). The solution was to add extra mime-types to /etc/mime/types: echo 'application/vnd.openxmlformats docx pptx xlsx' &#62;&#62; /etc/mime.types And then restart apache: sudo /etc/init.d/apache2 reload This would [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had an issue where various browsers on Windows desktops were saving <b>docx</b>, <b>xslx</b>, and <b>pptx</b> as zip files when downloaded from our linux web servers(apache in this case). The solution was to add extra mime-types to /etc/mime/types:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw3">echo</span> <span class="st_h">'application/vnd.openxmlformats       docx pptx xlsx'</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>mime.types</pre></div></div>

<p>And then restart apache:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>apache2 reload</pre></div></div>

<p>This would also require <b>mod_mime</b> to be loaded, and is by default in Debian based systems. To verify the location of the mime.types file your server is using, the following commands may be helpful(replace the httpd.conf or mods conf directory with your distributions location).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family: Monaco, monospace;"><span class="kw2">grep</span> <span class="re5">-n</span> mime.types <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>mods-available<span class="sy0">/*</span>
<span class="kw2">grep</span> <span class="re5">-n</span> mime.types <span class="sy0">/</span>etc<span class="sy0">/</span>apache2<span class="sy0">/</span>httpd.conf</pre></div></div>

<p>Linux desktops with <a href="http://www.openoffice.org/" target="_blank">Open Office</a> had no such problems <img src='http://jetpackweb.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jetpackweb.com/blog/2009/08/12/office-2007-docx-pptx-and-xslx-saving-as-zip-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
