<?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>blacknode &#187; Apache</title>
	<atom:link href="http://blog.blacknode.net/category/sysadmin/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.blacknode.net</link>
	<description>NO CARRIER</description>
	<lastBuildDate>Mon, 13 Jun 2011 07:12:29 +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>Topsy-Turvy</title>
		<link>http://blog.blacknode.net/2010/10/topsy-turvy/</link>
		<comments>http://blog.blacknode.net/2010/10/topsy-turvy/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 03:46:44 +0000</pubDate>
		<dc:creator>jrod</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://blog.blacknode.net/?p=527</guid>
		<description><![CDATA[My friend recently got a job with this place. I noticed this in my access log a few seconds after posting a link on twitter. That is faster than Jimmy Johns! 74.112.128.62 &#8211; - [06/Oct/2010:03:40:49 +0000] &#8220;GET /2010/10/disgusting/ HTTP/1.0&#8243; 200 17847 &#8220;-&#8221; &#8220;Mozilla/5.0 (compatible; Butterfly/1.0; +http://labs.topsy.com/butterfly/) Gecko/2009032608 Firefox/3.0.8&#]]></description>
			<content:encoded><![CDATA[<p>My friend recently got a job with this place.<br />
I noticed this in my access log a few seconds after posting a link on twitter. That is faster than Jimmy Johns!</p>
<blockquote><p>74.112.128.62 &#8211; - [06/Oct/2010:03:40:49 +0000] &#8220;GET /2010/10/disgusting/ HTTP/1.0&#8243; 200 17847 &#8220;-&#8221; &#8220;Mozilla/5.0 (compatible; Butterfly/1.0; +http://labs.topsy.com/butterfly/) Gecko/2009032608 Firefox/3.0.8&#8243;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.blacknode.net/2010/10/topsy-turvy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable core dumps with apache, RHEL5</title>
		<link>http://blog.blacknode.net/2009/07/enable-core-dumps-with-apache-rhel5/</link>
		<comments>http://blog.blacknode.net/2009/07/enable-core-dumps-with-apache-rhel5/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 20:53:44 +0000</pubDate>
		<dc:creator>jrod</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://blog.blacknode.net/?p=199</guid>
		<description><![CDATA[If you are like me, you had some trouble getting apache to dump core on a RHEL5 system. The following steps have produced positive results for me: echo "ulimit -c unlimited &#62;/dev/null 2&#62;&#38;1" &#62;&#62; /etc/profile echo "DAEMON_COREFILE_LIMIT='unlimited'" &#62;&#62; /etc/sysconfig/init echo 1 &#62; /proc/sys/fs/suid_dumpable echo "core.%p" &#62; /proc/sys/kernel/core_pattern echo "CoreDumpDirectory /var/apache-core-dumps" &#62; \ /etc/httpd/conf.d/core_dumps.conf mkdir /var/apache-core-dumps ]]></description>
			<content:encoded><![CDATA[<p>If you are like me, you had some trouble getting apache to dump core on a RHEL5 system. The following steps have produced positive results for me:</p>
<pre>echo "<code>ulimit -c unlimited &gt;/dev/null 2&gt;&amp;1</code>" &gt;&gt; /etc/profile
echo "<code>DAEMON_COREFILE_LIMIT='unlimited'</code>" &gt;&gt; /etc/sysconfig/init
echo 1 &gt; /proc/sys/fs/suid_dumpable
echo "core.%p" &gt; /proc/sys/kernel/core_pattern
echo "CoreDumpDirectory /var/apache-core-dumps" &gt; \
/etc/httpd/conf.d/core_dumps.conf
mkdir /var/apache-core-dumps
chown apache: /var/apache-core-dumps
source /etc/profile
/etc/init.d/httpd restart</pre>
<p>Now you can test it by sending a SIGSEGV to a random apache child process:</p>
<pre># tail -f /var/log/httpd/error_log | grep -i seg &amp;
# ps auxwww |grep httpd (pick a random pid not owned by root)
# kill -11 2014
# [Mon Jul 06 21:05:39 2009] [notice] child pid 2014 exit signal
Segmentation fault (11), possible coredump in /var/apache-core-dumps
# cd /var/apache-core-dumps
# ls
core.2014</pre>
<p>You can then get a backtrace using gdb:</p>
<pre># gdb /usr/sbin/httpd core.2014
(gdb) &gt; bt full</pre>
<p>I hope this helps someone. Please feel free to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blacknode.net/2009/07/enable-core-dumps-with-apache-rhel5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Redirect domain.com to www.domain.com, universal</title>
		<link>http://blog.blacknode.net/2009/07/redirect-domain-com-to-www-domain-com-universal/</link>
		<comments>http://blog.blacknode.net/2009/07/redirect-domain-com-to-www-domain-com-universal/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 18:09:56 +0000</pubDate>
		<dc:creator>jrod</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[System Administration]]></category>

		<guid isPermaLink="false">http://blog.blacknode.net/?p=189</guid>
		<description><![CDATA[I still get allot of these requests, so I thought I would share this. You can add this rewrite rule to the .htaccess file located at the domains documentroot or in the virtualhost or directory context of the apache configuration to achieve the desired result. RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule (.*) http://www.%{HTTP_HOST}$1 [QSA,R=301,]]></description>
			<content:encoded><![CDATA[<p>I still get allot of these requests, so I thought I would share this. You can add this rewrite rule to the .htaccess file located at the domains documentroot or in the virtualhost or directory context of the apache configuration to achieve the desired result.</p>
<blockquote><p>RewriteEngine On<br />
RewriteCond %{HTTP_HOST} !^www\. [NC]<br />
RewriteRule (.*) http://www.%{HTTP_HOST}$1 [QSA,R=301,L]</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.blacknode.net/2009/07/redirect-domain-com-to-www-domain-com-universal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect index.php to root of current directory</title>
		<link>http://blog.blacknode.net/2009/05/redirect-indexphp-to-root-of-current-directory/</link>
		<comments>http://blog.blacknode.net/2009/05/redirect-indexphp-to-root-of-current-directory/#comments</comments>
		<pubDate>Fri, 01 May 2009 18:11:20 +0000</pubDate>
		<dc:creator>jrod</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[webmaster]]></category>

		<guid isPermaLink="false">http://blog.blacknode.net/?p=162</guid>
		<description><![CDATA[An SEO conscious customer was having duplicate content issues for: http://domain.com/something/ and http://domain.com/something/index.php Simply rewriting index.php to / will not be effective as httpd makes an internal redirect to the DirectoryIndex, causing a redirect loop. In order to distinguish between the internal redirect and a client request, the %{THE_REQUEST} server variable is used. When placed ]]></description>
			<content:encoded><![CDATA[<p>An SEO conscious customer was having duplicate content issues for:</p>
<blockquote>
<p>http://domain.com/something/</p>
<p>and</p>
<p>http://domain.com/something/index.php</p>
</blockquote>
<p>Simply rewriting index.php to / will not be effective as httpd makes an internal redirect to the DirectoryIndex, causing a redirect loop.</p>
<p>In order to distinguish between the internal redirect and a client request, the %{THE_REQUEST} server variable is used.</p>
<p>When placed in the in the Directory context in the httpd.conf  or in the .htaccess file located in the document root or desired origin directory, the following rule will achieve the desired results:</p>
<blockquote><p>
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{THE_REQUEST} ^[A-Z]+\ (.*)/index.php\ HTTP/<br />
RewriteRule .*index.php$ http://%{HTTP_HOST}%1/ [L]
</p></blockquote>
<p>Note, this should be placed before any query_string rewriting you are doing for things like clean urls.</p>
<p>This will work recursively from its origin, so:</p>
<blockquote>
<p>http://domain.com/something/index.php</p>
<p>and</p>
<p>http://domain.com/something/else/index.php</p>
</blockquote>
<p>will be rewritten to:</p>
<blockquote>
<p>http://domain.com/something/</p>
<p>and</p>
<p>http://domain.com/something/else/</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.blacknode.net/2009/05/redirect-indexphp-to-root-of-current-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>tomcat + mod_jk + rhel5</title>
		<link>http://blog.blacknode.net/2008/11/tomcat-mod_jk-rhel5/</link>
		<comments>http://blog.blacknode.net/2008/11/tomcat-mod_jk-rhel5/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 08:24:38 +0000</pubDate>
		<dc:creator>jrod</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[tomcat redhat rhel5 mod_jk linux]]></category>

		<guid isPermaLink="false">http://blog.blacknode.net/?p=64</guid>
		<description><![CDATA[[Warning: This guide needs to be updated. 09.08.2009] v0.5 Because I&#8217;m tired of my peers thinking that the process is difficult, I decided to write a quick guide detailing the process of installing tomcat on rhel5 and configuring mod_jk with apache. RHEL5 provides tomcat5 via RHN, unless you have access to another secure and maintained ]]></description>
			<content:encoded><![CDATA[<p>[<span style="color: #ff0000;">Warning</span>: <strong>This guide needs to be updated. 09.08.2009</strong>]</p>
<p>v0.5</p>
<p>Because I&#8217;m tired of my peers thinking that the process is difficult, I decided to write a quick guide detailing the process of installing tomcat on rhel5 and configuring mod_jk with apache.</p>
<p>RHEL5 provides tomcat5 via RHN, unless you have access to another secure and maintained repository that provides tomcat, I recommend using RedHat&#8217;s package.</p>
<p>To install tomcat:</p>
<blockquote><p><code>yum install tomcat5</code><br />
<code>/etc/init.d/tomcat5 start</code><br />
<code>chkconfig --levels 345 tomcat5 on</code></p></blockquote>
<p>This will install and start the tomcat5 web server on port 8080. The redhat tomcat rpms are nearly identical in implementation to the jpackage rpms. $CATALINA_HOME is still /usr/share/tomcat5. That directory contains symlinks to other places.  So /usr/share/tomcat5/conf  is a link to /etc/tomcat5.</p>
<p>To test the installation, I use the tomcats sample webapp which can be acquired and deployed like so:</p>
<blockquote><p><code>wget http://tomcat.apache.org/tomcat-5.5-doc/appdev/sample/sample.war</code><br />
<code>mv sample.war /usr/share/tomcat5/webapps</code></p></blockquote>
<p>The cool thing about .war files is the way tomcat interacts with them.  Simply moving the sample.war to $CATALINA_HOME/wabapps will deploy the web base application. Tomcat will automatically extract, or explode sample.war to $CATALINA_HOME/wabapps/sample.</p>
<p>You can access the newly deployed application via the tomcat web server.</p>
<blockquote><p><code>http://foo.bar:8080/sample/</code></p></blockquote>
<p>If you have  installed the tomcat5-webapps package, you will notice some other directories populating the webapps directory. There is a special webapp directory called <em>ROOT</em> which represents the root of the tomcat server, which can always be accessed by going to the root of the server.</p>
<blockquote><p><code>http://foo.bar:8080/</code></p></blockquote>
<p>Unless you plan on running tomcat on port 80, you are going to want apache to hand off, or connect, requests to the tomcat server. This is where mod_jk comes into the picture. mod_jk is an apache module known as a <a href="http://tomcat.apache.org/connectors-doc/">connector</a>.</p>
<p>First, download the correct binary for your architecture and install it:</p>
<blockquote><p><code>wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.23/mod_jk-1.2.23-apache-2.2.x-linux-i686.so</code></p>
<p>***<br />
For x86_64 change to:</p>
<p>wget http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.23/mod_jk-1.2.23-apache-2.2.x-linux-x86_64.so<br />
***</p>
<p>chmod +x mod_jk-1.2.23-apache-2.2.x-linux-i686.so<br />
cp -av mod_jk-1.2.23-apache-2.2.x-linux-i686.so /etc/httpd/modules/mod_jk.so</p></blockquote>
<p><code>vim /etc/httpd/conf.d/mod_jk.conf</code></p>
<blockquote><p>LoadModule jk_module modules/mod_jk.so</p>
<p>JkWorkersFile /etc/httpd/conf/workers.properties<br />
JkShmFile /var/log/httpd/mod_jk.shm<br />
JkLogFile /var/log/httpd/mod_jk.log<br />
JkLogLevel info</p></blockquote>
<p><code><br />
vim /etc/httpd/conf/workers.properties<br />
</code></p>
<blockquote><p>workers.tomcat_home=/usr/share/tomcat5</p>
<p>workers.java_home=/usr/lib/jvm/java</p>
<p>worker.list=jkworker</p>
<p>worker.jkworker.port=8009<br />
worker.jkworker.host=localhost<br />
worker.jkworker.type=ajp13</p></blockquote>
<p>Now restart apache:</p>
<blockquote><p><code>/etc/init.d/httpd configtest<br />
/etc/init.d/httpd restart<br />
</code></p></blockquote>
<p>At this point you have everything you need to run jsp pages and servlets with tomcat, while still hanging on to familiar httpd virtual hosting and configuration.  If you have not read the tomcat documentation on connectors, then you should at this point.</p>
<p>In order to use mod_jk to <em>connect</em> to a tomcat webapp, we need to mount it via the apache configuration. The JkMount directive takes care of this for us. To demonstrate this run the following:</p>
<blockquote><p><code>mkdir /usr/share/tomcat5/webapps/test/</code></p></blockquote>
<p>vim /usr/share/tomcat5/webapps/test/index.jsp</p>
<blockquote><p>Hello, I am a jsp script!</p>
<p>&lt;%<br />
// get client locale<br />
java.util.Locale locale = request.getLocale();</p>
<p>// get Dateformat for client&#8217;s locale<br />
java.text.DateFormat dateFormat =<br />
java.text.DateFormat.getDateTimeInstance(<br />
java.text.DateFormat.LONG,<br />
java.text.DateFormat.LONG, locale);</p>
<p>%&gt;</p>
<p>The time is:<br />
&lt;%=dateFormat.format( new java.util.Date() ) %&gt;</p></blockquote>
<p>Now add the following somewhere in the apache configuration:</p>
<blockquote><p>JkMount /test/* jkworker</p></blockquote>
<p>JkMount works similar to the apache alias directive. It can be used in the main configuration or virtualhost context. For testing purposes, you can append the mount line to your mod_jk.conf file.</p>
<p>Restart apache and hit the following:</p>
<blockquote><p>http://localhost/test/</p></blockquote>
<p>Tomcat ships with a web based administration webapp and also a manager webapp that can be used to deploy other webapps. To use these features, you need to install them from rhn if they have not already been installaed:</p>
<blockquote><p>yum install tomcat5-admin-webapps</p></blockquote>
<p>In order to access these webapps, you need to first authenticate.  In tomcat, you can define users and user roles. Users and roles are defined in $CATALINA_HOME/conf/tomcat-users.xml (/etc/tomat5/tomcat-users.xml). The admin webapps require authenticated users to have certain roles before they are granted access. For the admin webapp, a user who has the role &#8216;admin&#8217; is granted access. For the manager webapp, the user will need the &#8216;manager&#8217; role.</p>
<p>By default, the admin and manager roles are not created so you must define them and assign a user to them. I typically create an &#8216;admin&#8217; user and give that user both the admin and manager roles. Open up /etc/tomat5/tomcat-users.xml and edit it to look like this:</p>
<blockquote><p>&lt;?xml version=&#8217;1.0&#8242; encoding=&#8217;utf-8&#8242;?&gt;<br />
&lt;tomcat-users&gt;<br />
&lt;role rolename=&#8221;admin&#8221;/&gt;<br />
&lt;role rolename=&#8221;tomcat&#8221;/&gt;<br />
&lt;role rolename=&#8221;manager&#8221;/&gt;<br />
&lt;role rolename=&#8221;role1&#8243;/&gt;<br />
&lt;user username=&#8221;admin&#8221; password=&#8221;SuperSecretPassword&#8221; roles=&#8221;admin,tomcat,manager&#8221;/&gt;<br />
&lt;user username=&#8221;tomcat&#8221; password=&#8221;tomcat&#8221; roles=&#8221;tomcat&#8221;/&gt;<br />
&lt;user username=&#8221;both&#8221; password=&#8221;tomcat&#8221; roles=&#8221;tomcat,role1&#8243;/&gt;<br />
&lt;user username=&#8221;role1&#8243; password=&#8221;tomcat&#8221; roles=&#8221;role1&#8243;/&gt;<br />
&lt;/tomcat-users&gt;</p></blockquote>
<p>Now you can access both the manager and the admin panel with the admin user. Try this out:</p>
<blockquote><p>httpd://yourdomain.net:8080/admin<br />
httpd://yourdomain.net:8080/manager</p></blockquote>
<p>If you don&#8217;t want to type the port, you can mount the apps with JkMount /admin/* jkworker or JkMount /manager/* jkworker.</p>
<p>At present, this <em>guide</em> is far from complete.  However, I think something like this would have helped me the first time I had to install tomcat on a shared server. Please feel free to post comments and flames.</p>
<p>jrod@blacknode.net</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.blacknode.net/2008/11/tomcat-mod_jk-rhel5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

