<?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>The Accidental Developer &#187; apache</title>
	<atom:link href="http://osric.com/chris/accidental-developer/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://osric.com/chris/accidental-developer</link>
	<description>What if Gregor Samsa awoke a computer programmer?</description>
	<lastBuildDate>Sat, 28 Jan 2012 23:13:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Monitoring web server status with a shell script</title>
		<link>http://osric.com/chris/accidental-developer/2011/09/monitoring-web-server-status-with-a-shell-script/</link>
		<comments>http://osric.com/chris/accidental-developer/2011/09/monitoring-web-server-status-with-a-shell-script/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 16:00:48 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=499</guid>
		<description><![CDATA[Recently, my VPS (Virtual Private Server) ran into some issues where it exceeded the maximum amount of RAM allotted under my subscription. When this happens, the web server software shuts down and does not restart until I manually restart it. This is bad. I&#8217;m not always visiting my own web site, so it could be [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, my VPS (Virtual Private Server) ran into some issues where it exceeded the maximum amount of RAM allotted under my subscription. When this happens, the web server software shuts down and does not restart until I manually restart it.</p>
<p>This is bad. I&#8217;m not always visiting my own web site, so it could be down for days without me knowing. Although I really need to identify what is using all the RAM, in the meantime I&#8217;ll settle for a monitoring system that will notify me when the server is down.</p>
<pre><code>#!/bin/bash
if curl -s --head http://osric.com/ | grep "200 OK" &gt; /dev/null
  then
    echo "The HTTP server on osric.com is up!" &gt; /dev/null
  else
    echo "The HTTP server on osric.com is down!"
fi</code></pre>
<p><a href="http://curl.haxx.se/" title="cURL">cURL</a> will let you retrieve a URL via the command line, and provides more options than <a href="http://www.gnu.org/s/wget/" title="Wget">Wget</a> for a single URL. In this case, I used the <em>silent</em> switch to eliminate the status/progress output, and the <em>head</em> switch to retrieve only the document headers. The document header is then piped to <a href="http://www.gnu.org/s/grep/" title="Grep">Grep</a>, which searches for the string &#8220;200 OK&#8221; (the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1" title="HTTP status message 200 OK">HTTP status message for a successful request</a>).</p>
<p>I send the result of that to /dev/null so that the output doesn&#8217;t appear on the screen.</p>
<p>If grep does find 200 OK, then I send a success message to /dev/null. This is largely unnecessary, but it is nice to leave in to test the script in a successful case&#8211;just remove the <code>&gt; /dev/null</code>. If it doesn&#8217;t find 200 OK, then there is a problem. It might not mean, necessarily, that the web server is down, but it definitely indicates there is a problem that needs to be identified.</p>
<p>I added a call to this script to a crontab to run every 5 minutes. If there is no output, nothing happens. If there is output, the output is sent to me via e-mail, which, assuming I am checking my e-mail religiously, should reduce server downtime.</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2011/09/monitoring-web-server-status-with-a-shell-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apache Install and Ambiguous Errors</title>
		<link>http://osric.com/chris/accidental-developer/2009/07/apache-error-only-one-usage-of-each-socket-address/</link>
		<comments>http://osric.com/chris/accidental-developer/2009/07/apache-error-only-one-usage-of-each-socket-address/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 21:39:34 +0000</pubDate>
		<dc:creator>Chris Herdt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://osric.com/chris/accidental-developer/?p=177</guid>
		<description><![CDATA[I installed Apache 2.2.11 on the Windows XP portion of my desktop workstation for development purposes, but I got a lot of ambiguous errors when starting from the Apache Service Monitor or the Windows start menu. Finally, when I started Apache from the command line I got a more informative error: (OS 10048) Only one [...]]]></description>
			<content:encoded><![CDATA[<p>I installed Apache 2.2.11 on the Windows XP portion of my desktop workstation for development purposes, but I got a lot of ambiguous errors when starting from the Apache Service Monitor or the Windows start menu.</p>
<p>Finally, when I started Apache from the command line I got a more informative error:<br />
(OS 10048) Only one usage of each socket address (protocal/network address/port) is normally permitted. : make_sock: could not bind to address 127.0.0.1:80 no listening sockets available, shutting down</p>
<p>It turns out, I had Skype running, which by default binds to ports 5520, 80, and 443. There are several solutions:<br />
<span id="more-177"></span></p>
<ol>
<li>Quit Skype and don&#8217;t run Skype and Apache at the same time. Not ideal, but it works.</li>
<li>Change which port Apache uses. In your Apache2/conf/httpd file, change the line &#8220;Listen 80&#8243; to something like &#8220;Listen 8888&#8243;. Apache should start, but you&#8217;ll need to access it via http://localhost:8888 instead of merely http://localhost</li>
<li>Change which ports Skype uses for incoming connections. Go to <em>Tools&#8211;Options&#8211;Advanced&#8211;Connection</em> and un-check the box next to &#8220;Use port 80 and 443 as alternatives for incoming connections.&#8221;</li>
</ol>
<p>As far as I can tell, the last option has no ill-effect on Skype, although it might if your firewall or router is blocking port 5520.</p>
<p>I ended up installing Apache 2.0 in addition to Apache 2.2, as I was having trouble with mod_perl with the latter. I ran into the same issue there as well, and once I quit Skype I was able to start Apache.</p>
<p>Strangely enough, I now seem to have both Skype and Apache running and both listening on port 80, so perhaps I&#8217;ve misdiagnosed the problem completely.</p>
]]></content:encoded>
			<wfw:commentRss>http://osric.com/chris/accidental-developer/2009/07/apache-error-only-one-usage-of-each-socket-address/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

