<?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>Ali Aboosaidi &#187; apache</title>
	<atom:link href="http://insanelabs.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://insanelabs.com</link>
	<description>Umm... Unorthodox?</description>
	<lastBuildDate>Tue, 08 Nov 2011 21:04:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Apache:  NameVirtualHost *:80 has no VirtualHosts error message</title>
		<link>http://insanelabs.com/linux/apache-namevirtualhost-80-has-no-virtualhosts-error-message/</link>
		<comments>http://insanelabs.com/linux/apache-namevirtualhost-80-has-no-virtualhosts-error-message/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 19:42:45 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[namevirtualhost]]></category>
		<category><![CDATA[virtualhost]]></category>

		<guid isPermaLink="false">http://insanelabs.com/?p=968</guid>
		<description><![CDATA[If you&#8217;re getting the following error when trying to restart Apache server: NameVirtualHost *:80 has no VirtualHosts Edit your ports.conf: nano /etc/apache2/ports.conf and comment out NameVirtualHost towards the top of your config file. This should work considering all other settings are correct. Related posts: Linux: Apache Tomcat tips and tricks Outlook: cannot start microsoft office [...]
Related posts:<ol>
<li><a href="http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/" rel='bookmark' title='Linux: Apache Tomcat tips and tricks' class="liinternal">Linux: Apache Tomcat tips and tricks</a></li>
<li><a href="http://insanelabs.com/misc/outlook-cannot-start-microsoft-office-outlook-cannot-open-the-outlook-window-error-message/" rel='bookmark' title='Outlook: cannot start microsoft office outlook. cannot open the outlook window error message' class="liinternal">Outlook: cannot start microsoft office outlook. cannot open the outlook window error message</a></li>
<li><a href="http://insanelabs.com/linux/misc-error-500-internal-server-error-while-editing-posts-unable-to-view-wordpress-dashboard-items/" rel='bookmark' title='Misc: Error 500 &#8211; Internal server error while editing posts &#8211; unable to view wordpress dashboard items' class="liinternal">Misc: Error 500 &#8211; Internal server error while editing posts &#8211; unable to view wordpress dashboard items</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re getting the following error when trying to restart Apache server:</p>
<pre> NameVirtualHost *:80 has no VirtualHosts</pre>
<p>Edit your ports.conf:</p>
<pre> nano /etc/apache2/ports.conf </pre>
<p>and comment out NameVirtualHost towards the top of your config file.</p>
<p>This should work considering all other settings are correct.</p>
<p>Related posts:<ol>
<li><a href="http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/" rel='bookmark' title='Linux: Apache Tomcat tips and tricks' class="liinternal">Linux: Apache Tomcat tips and tricks</a></li>
<li><a href="http://insanelabs.com/misc/outlook-cannot-start-microsoft-office-outlook-cannot-open-the-outlook-window-error-message/" rel='bookmark' title='Outlook: cannot start microsoft office outlook. cannot open the outlook window error message' class="liinternal">Outlook: cannot start microsoft office outlook. cannot open the outlook window error message</a></li>
<li><a href="http://insanelabs.com/linux/misc-error-500-internal-server-error-while-editing-posts-unable-to-view-wordpress-dashboard-items/" rel='bookmark' title='Misc: Error 500 &#8211; Internal server error while editing posts &#8211; unable to view wordpress dashboard items' class="liinternal">Misc: Error 500 &#8211; Internal server error while editing posts &#8211; unable to view wordpress dashboard items</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://insanelabs.com/linux/apache-namevirtualhost-80-has-no-virtualhosts-error-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux: Run tomcat with apache &#8211; mod_jk configuration</title>
		<link>http://insanelabs.com/linux/linux-run-tomcat-with-apache-mod_jk-configuration/</link>
		<comments>http://insanelabs.com/linux/linux-run-tomcat-with-apache-mod_jk-configuration/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 19:27:59 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mod_jk]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://insanelabs.com/?p=385</guid>
		<description><![CDATA[Disclaimer: I found an old note with these instructions on it. I&#8217;m sure that I&#8217;ve taken these from other blog(s) but unfortunately I cannot find the source to give complete credit to. Since this is a very useful how-to I decided to clean it up and publish it for everyone to read, but if author(s) [...]
Related posts:<ol>
<li><a href="http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/" rel='bookmark' title='Linux: Apache Tomcat tips and tricks' class="liinternal">Linux: Apache Tomcat tips and tricks</a></li>
<li><a href="http://insanelabs.com/linux/linux-release-port-8080-after-stopping-tomcat-port-8080-in-use-by-java/" rel='bookmark' title='Linux: Release port 8080 after stopping Tomcat &#8211; Port 8080 in use by Java' class="liinternal">Linux: Release port 8080 after stopping Tomcat &#8211; Port 8080 in use by Java</a></li>
<li><a href="http://insanelabs.com/misc/tomcat-redirect-default-home-page-to-another-url/" rel='bookmark' title='Tomcat: Redirect default home page to another URL' class="liinternal">Tomcat: Redirect default home page to another URL</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Disclaimer: I found an old note with these instructions on it. I&#8217;m sure that I&#8217;ve taken these from other blog(s) but unfortunately I cannot find the source to give complete credit to. Since this is a very useful how-to I decided to clean it up and publish it for everyone to read, but if author(s) stumble upon this page and provide a link to original document(s) I will be more than happy to give them full credit.</p>
<p>There are a few reasons why we&#8217;d want to configure Tomcat to run with Apache. For me the most important is security and the fact that I&#8217;d like to run my web servers on port 80. In order to run Tomcat on port 80 it has to run as root which is not safe and absolutely not recommended. I am going to show you how to configure your Apache to run and pass connections to Tomcat.</p>
<p>What I normally like to do in such situation is to compile Apache instead of installing from repositories, install and configure Java and Tomcat, and then complile mod_jk to provide Tomcat/Apache connector. Basically all steps will be manual. Perhaps all this can be done using repositories too, but this way I can keep things updated as they updates come out by the developers, not when they become available in repositories.</p>
<p>To simplify the solution and make it a universal tutorial, I am going to refer to each product by its name. Therefore we will be renaming all extracted folders to their generic names. For instance, latest versions of Apache, Tomcat, Java and mod_jk are 2.2.11, 6.0.18, 6u11 and 1.2.27 respectively (Jan 09), but we are going to refer to them as just Apache, Tomcat, Java and mod_jk. I have actually renamed them right after they were extracted before I placed them onto their permanent directories. I am going to use /usr/local as my installation directory but you can place them in /opt or any other directory you wish.</p>
<p>Most steps are performed under a non-root account. I will let you know when to use the root account.</p>
<p><strong>Installing Apache:</strong></p>
<ol>
<li>Log on with your non-root account.</li>
<li>Download Apache tar package from <a href="http://www.apache.org" class="linkification-ext" title="Linkification: http://www.apache.org" target="_blank">http://www.apache.org</a> and extract. This directory will be called &#8220;apache&#8221; from this point forward.</li>
<li>Change directory to apache &#8216;cd apache&#8217;.</li>
</ol>
<p><strong>Prepare the product to compile:</strong></p>
<ol>
<li>In apache directory:
<pre>./configure --prefix=/usr/local/apache</pre>
</li>
<li><span style="color: #ff6600;">make</span></li>
<li>Change to root user: <span style="color: #ff6600;">su</span></li>
<li><span style="color: #ff6600;">make install</span></li>
</ol>
<p>Once it&#8217;s complete run apache:</p>
<pre>/usr/local/apache/bin/apachectl start</pre>
<p>test installation by browsing the target address. If it&#8217;s running then stop the process:</p>
<pre>/usr/local/apache/bin/apachectl stop</pre>
<p><strong>Install Java (I&#8217;m using jdk):</strong></p>
<ol>
<li>Download Java self-extracting package from <a href="http://www.java.com" class="linkification-ext" title="Linkification: http://www.java.com" target="_blank">http://www.java.com</a>. Whatever this file is, we call it java.bin.</li>
<li>Make it executable:<br />
<span style="color: #ff6600;">chmod +x java.bin</span></li>
<li>Execute:<br />
<span style="color: #ff6600;">./java.bin</span></li>
<li>Once you&#8217;re done with the installation you will have a directory jre1xxxxx. We will refer to this directory as &#8220;java&#8221;.</li>
<li>Become root: <span style="color: #ff6600;">su (to move directory to /usr/local)<br />
</span></li>
<li>Move the directory to its final resting place. Mine sits in /usr/local:<br />
<span style="color: #ff6600;">mv java /usr/local</span></li>
</ol>
<p><strong>Install Tomcat:</strong></p>
<ol>
<li>Download Tomcat from <a href="http://tomcat.apache.org" class="linkification-ext" title="Linkification: http://tomcat.apache.org" target="_blank">http://tomcat.apache.org</a> and extract the tar ball. We will call this directory &#8220;tomcat&#8221; from now on.</li>
<li>Become root: <span style="color: #ff6600;">su (to move directory to /usr/local)<br />
</span></li>
<li>Move this directory to /usr/local:<br />
<span style="color: #ff6600;">mv tomcat /usr/local</span></li>
</ol>
<p>Now it&#8217;s time to configure our paths. Edit your .bash_profile:</p>
<p><span style="text-decoration: underline;"><strong>STOP:</strong></span> This is local to the user running Tomcat. Each user who&#8217;ll be running Tomcat should have a bash_profile in their own home directory.<br />
<span style="color: #ff6600;"> nano ~/.bash_profile</span></p>
<p>and add the following lines:</p>
<pre>export JRE_HOME=/usr/local/java
export JAVA_HOME=/usr/local/java
export CATALINA_HOME=/usr/local/tomcat</pre>
<p>Save and exit, then execute the following command:<br />
<span style="color: #ff6600;"> source ~/.bash_profile</span></p>
<p>Now test your Tomcat: as non-root user:</p>
<pre>/usr/local/tomcat/bin/startup.sh</pre>
<p>browse to <a href="http://localhost:8080" class="linkification-ext" title="Linkification: http://localhost:8080" target="_blank">http://localhost:8080</a>. If it&#8217;s working then shut it down:</p>
<pre>/usr/local/tomcat/bin/shutdown.sh</pre>
<p><strong>Installing connector (mod_jk):</strong></p>
<ol>
<li>Download mod_jk connector from <a href="http://tomcat.apache.org/download-connectors.cgi" class="linkification-ext" title="Linkification: http://tomcat.apache.org/download-connectors.cgi" target="_blank">http://tomcat.apache.org/download-connectors.cgi</a> and extract. We will call this new directory &#8220;connector&#8221;.</li>
<li>Go to connector/native.</li>
<li>To prepare:
<pre>./configure --with-apxs=/usr/local/apache/bin/apxs</pre>
</li>
<li><span style="color: #ff6600;">make<br />
</span></li>
<li>Become root and:<br />
<span style="color: #ff6600;">make install</span></li>
<li>Check to see if mod_jk.so is in /usr/local/apache/modules. If it&#8217;s there then you&#8217;ve so far been successful.</li>
</ol>
<p><strong>Create the connector:</strong></p>
<p>Create a file called &#8220;connector.conf&#8221; in apache/conf directory:</p>
<pre>nano /usr/local/apache/conf/connector.conf</pre>
<p>and copy/paste the following lines in that file, save and exit:</p>
<pre>workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
ps=/
worker.list=myworker
worker.myworker.port=8009
worker.myworker.host=localhost
worker.myworker.type=ajp13
worker.myworker.lbfactor=1</pre>
<p>Add the following lines to httpd.conf:</p>
<pre>LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/connector.conf
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkMount /*.jsp myworker
JkMount /* myworker</pre>
<p>Now, start both Apache and Tomcat. You should be able to view the Tomcat default page in <a href="http://localhost" class="linkification-ext" title="Linkification: http://localhost" target="_blank">http://localhost</a> AND <a href="http://localhost:8080" class="linkification-ext" title="Linkification: http://localhost:8080" target="_blank">http://localhost:8080</a>. This means that the connector is working. To increase security disable http access to Tomcat through port 8080.</p>
<p>Note: Apache will automatically start after reboot, but you will have to add Tomcat to your startup script manually. Here is a startup script you can copy to your /etc/init.d and make it executable to start/stop your server. I don&#8217;t remember where I got this script from, but just so you know, it&#8217;s not mine. Good thing about this script is that even if you run this as root, it will run your Tomcat server as user specified in line 6.</p>
<p>Note: become root to run Apache. If you use the following script for your Tomcat, you may also run it as root. It will switch to specified user once it&#8217;s executed. I don&#8217;t use the script, however, what I do is to add it to my root crontab and have run it as non-root user. This is the command I use:</p>
<pre>su - &lt;username&gt; -c /usr/local/tomcat/bin/startup.sh</pre>
<p>Here is the script to run Tomcat (not mine, I found it in a mailing list):</p>
<pre>#!/bin/sh
# Tomcat Startup Script

TOMCAT_OWNER=&lt;user who will run tomcat&gt;; export TOMCAT_OWNER

start() {
        echo -n "Starting Tomcat: "
        su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh
        sleep 2
}
stop() {
        echo -n "Stopping Tomcat: "
        su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh
}

# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
restart)
        stop
        start
        ;;
*)
        echo $"Usage: tomcat {start|stop|restart}"
        exit
esac
</pre>
<p>Related posts:<ol>
<li><a href="http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/" rel='bookmark' title='Linux: Apache Tomcat tips and tricks' class="liinternal">Linux: Apache Tomcat tips and tricks</a></li>
<li><a href="http://insanelabs.com/linux/linux-release-port-8080-after-stopping-tomcat-port-8080-in-use-by-java/" rel='bookmark' title='Linux: Release port 8080 after stopping Tomcat &#8211; Port 8080 in use by Java' class="liinternal">Linux: Release port 8080 after stopping Tomcat &#8211; Port 8080 in use by Java</a></li>
<li><a href="http://insanelabs.com/misc/tomcat-redirect-default-home-page-to-another-url/" rel='bookmark' title='Tomcat: Redirect default home page to another URL' class="liinternal">Tomcat: Redirect default home page to another URL</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://insanelabs.com/linux/linux-run-tomcat-with-apache-mod_jk-configuration/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Linux: Apache Tomcat tips and tricks</title>
		<link>http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/</link>
		<comments>http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 21:14:31 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jre]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://insanelabs.com/?p=209</guid>
		<description><![CDATA[JAVA_HOME or JRE_HOME variables are not defined: Edit bash_profile for the user running Tomcat: nano ~/.bash_profile Add the following line and edit to point to correct directory: export JRE_HOME=/usr/local/jre Save and exit, then execute the following command: source ~/.bash_profile Running Apache Tomcat on privileged ports (lower then 1024) as non-root user: The best way is [...]
Related posts:<ol>
<li><a href="http://insanelabs.com/linux/linux-run-tomcat-with-apache-mod_jk-configuration/" rel='bookmark' title='Linux: Run tomcat with apache &#8211; mod_jk configuration' class="liinternal">Linux: Run tomcat with apache &#8211; mod_jk configuration</a></li>
<li><a href="http://insanelabs.com/linux/apache-namevirtualhost-80-has-no-virtualhosts-error-message/" rel='bookmark' title='Apache: NameVirtualHost *:80 has no VirtualHosts error message' class="liinternal">Apache:  NameVirtualHost *:80 has no VirtualHosts error message</a></li>
<li><a href="http://insanelabs.com/linux/linux-reset-iptables-firewall-rules/" rel='bookmark' title='Linux: Reset iptables firewall rules' class="liinternal">Linux: Reset iptables firewall rules</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>JAVA_HOME or JRE_HOME variables are not defined:</p>
<p>Edit bash_profile for the user running Tomcat:</p>
<pre>nano ~/.bash_profile</pre>
<p>Add the following line and edit to point to correct directory:</p>
<pre>export JRE_HOME=/usr/local/jre</pre>
<p>Save and exit, then execute the following command:</p>
<pre>source ~/.bash_profile</pre>
<p>Running Apache Tomcat on privileged ports (lower then 1024) as non-root user:</p>
<p>The best way is to set an iptables rule to forwards incoming requests from port 80 to 8080:</p>
<pre>iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080</pre>
<p><a href="http://insanelabs.com/linux/linux-run-tomcat-with-apache-mod_jk-configuration/" class="liinternal">or setup apache with mod_jk connector to pass http requests to tomcat</a></p>
<p>Related posts:<ol>
<li><a href="http://insanelabs.com/linux/linux-run-tomcat-with-apache-mod_jk-configuration/" rel='bookmark' title='Linux: Run tomcat with apache &#8211; mod_jk configuration' class="liinternal">Linux: Run tomcat with apache &#8211; mod_jk configuration</a></li>
<li><a href="http://insanelabs.com/linux/apache-namevirtualhost-80-has-no-virtualhosts-error-message/" rel='bookmark' title='Apache: NameVirtualHost *:80 has no VirtualHosts error message' class="liinternal">Apache:  NameVirtualHost *:80 has no VirtualHosts error message</a></li>
<li><a href="http://insanelabs.com/linux/linux-reset-iptables-firewall-rules/" rel='bookmark' title='Linux: Reset iptables firewall rules' class="liinternal">Linux: Reset iptables firewall rules</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://insanelabs.com/linux/linux-apache-tomcat-tips-and-tricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

