<?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>vincentkong.com &#187; Apache</title>
	<atom:link href="http://www.vincentkong.com/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>https://www.vincentkong.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 07 Jul 2010 00:32:21 +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>Apache HTTP Authentication</title>
		<link>https://www.vincentkong.com/2008/02/apache-http-authentication</link>
		<comments>https://www.vincentkong.com/2008/02/apache-http-authentication#comments</comments>
		<pubDate>Thu, 28 Feb 2008 15:31:19 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=81</guid>
		<description><![CDATA[This covers how to protect parts of a website in Apache using the .htaccess files. To use .htaccess files, you need to enable it in the server configuration by specifying the directive AllowOverride AuthConfig, typically within the &#60;Directory&#62; section. &#60;Directory /opt/apache/htdocs&#62; AllowOverride AuthConfig &#60;/Directory&#62; Create a password file, which should be placed somewhere not accessible [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy' rel='bookmark' title='Permanent Link: Apache mod_proxy and Reverse Proxy'>Apache mod_proxy and Reverse Proxy</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This covers how to protect parts of a website in Apache using the <code>.htaccess</code> files.</p>
<p>To use <code>.htaccess </code>files, you need to enable it in the server configuration by specifying the directive <code>AllowOverride AuthConfig</code>, typically within the <code>&lt;Directory&gt;</code> section.<br />
<code>&lt;Directory /opt/apache/htdocs&gt;<br />
AllowOverride AuthConfig<br />
&lt;/Directory&gt; </code></p>
<p>Create a password file, which should be placed somewhere not accessible from the web. For example if your documents are served in the directory <code>/opt/apache/htdocs</code>, you can put the password file in the <code>/opt/apache/passwd directory</code>. To create the file use the <code>htpasswd</code> command that came with Apache.</p>
<p><code>$ htpasswd -c /opt/apache/passwd/passwords myusername </code></p>
<p>Create an <code>.htaccess </code>file in the diretory you wish to protect. For example, if you wish to protect the directory <code>/opt/apache/htdocs/protect</code>:</p>
<p><code>$ cd /usr/local/apache/htdocs/protect/<br />
$ nano .htaccess </code></p>
<p>Add the following lines inside the file:</p>
<p><code>AuthType Basic<br />
AuthName "Restricted Files"<br />
AuthUserFile /opt/apache/passwd/passwords<br />
Require user myusername<br />
</code></p>
<ul>
<li>The <code>AuthType</code> directive determines the method that is used to authenticate the user. The most common method is <code>Basic</code>, however, it sends the password unencrypted.</li>
<li>The <code>AuthName</code> directive sets the <em>Realm</em> to be used in the authentication. The realm is used by the browser to determine what password to send for a given authenticated area.</li>
<li>The <code>AuthUserFile</code> directive sets the path to the password file that created with <code>htpasswd</code>.</li>
<li>The <code>Require</code> directive provides the authorization part of the process by setting the user that is allowed to access the protected area. To allow anyone in that is listed in the password file use:<code> </code>Require valid-user</li>
</ul>
<p>Once the <code>.htaccess</code> file has been saved, you have restricted access to the area you want to protect.</p>
<p>For more information: <a href="http://httpd.apache.org/docs/2.0/howto/auth.html">http://httpd.apache.org/docs/2.0/howto/auth.html</a></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy' rel='bookmark' title='Permanent Link: Apache mod_proxy and Reverse Proxy'>Apache mod_proxy and Reverse Proxy</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2008/02/apache-http-authentication/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Apache for SSL Support</title>
		<link>https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support</link>
		<comments>https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support#comments</comments>
		<pubDate>Tue, 12 Jun 2007 15:37:02 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=84</guid>
		<description><![CDATA[SSL stands for Secure Sockets Layer and TLS stands for Transport Layer Security. They are a family protocols that were originially designed to provide security for HTTP transactions, but can also be used for other internet protocols. The following will describe the procedure for configuring the Apache2 HTTP server to provide HTTPS connections using OpenSSL. [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/06/apache-log-file-rotation' rel='bookmark' title='Permanent Link: Apache Log File Rotation'>Apache Log File Rotation</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>SSL stands for Secure Sockets Layer and TLS stands for Transport Layer Security. They are a family protocols that were originially designed to provide security for HTTP transactions, but can also be used for other internet protocols. The following will describe the procedure for configuring the Apache2 HTTP server to provide HTTPS connections using OpenSSL.</p>
<p><strong>Managing Certificates</strong></p>
<p>To have a working SSL implementation, the first step is to create a server certificate using the <code>openssl</code> command.</p>
<p>A public/private key pair must be generated before you can create a certificate request. Create the key with the following command line:</p>
<p><code>$ openssl genrsa -des3 -out server.key 1024</code></p>
<ul>
<li><code>genrsa</code> indicates to generate a key pair</li>
<li><code>des3</code> indicates the key protected by a pass phrase</li>
<li><code>out</code> indicates where to store the results</li>
<li><code>1024</code> indicates the number of bits of the generated key</li>
</ul>
<p>This certificate will prompt Apache to ask for the passphrase at each startup. If you don&#8217;t want Apache to prompt you for a passphrase everytime you start or restart it, remove the &#8220;<code>-des3</code>&#8221; option.</p>
<p>To learn about the contents of the key file use the following command:</p>
<p><code>$ openssl rsa -noout -text -in server.key</code></p>
<p>To get a certificate issued by a CA, you must submit what is called a <em>certificate signing request</em>. To create a request, issue the following command:</p>
<p><code>$ openssl req -new -key server.key -out server.csr </code></p>
<p>You will be prompted to enter the certificate information, it&#8217;s important that the Common Name field entry matches the address of your website. If the name is different, a warning from the web browser indicating the mismatch will be issue to the user.</p>
<p>To learn about the contents of the certificate use the following command:</p>
<p><code>$ openssl req -noout -text -in server.csr</code></p>
<p>You can submit the certificate signing request file to a CA for processing, if it&#8217;s for board internet use. For example: <a href="http://www.verisign.com/">VeriSign</a> or <a href="http://www.thawte.com/">Thawte</a>. If the certificate is for development, testing or internal use, you can create a self-signed certificate.</p>
<p><code>$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt</code></p>
<p>The default value is 30 days without the &#8220;<code>-days</code>&#8221; option.</p>
<p>Note: Your certificate private key should be only readable by the root user.</p>
<p><strong>Configuring Apache for Ubuntu</strong></p>
<p>Place the certificate and the certificate private key in the directory <code>/etc/apache2/ssl</code>.</p>
<p>Enable the ssl module for Apache</p>
<p><code>$ a2enmod ssl</code></p>
<p>Enable Apache to listen to the HTTPS default port 443 by adding the following line to the <code>/etc/apache2/ports.conf</code></p>
<pre>&lt;IfModule mod_ssl.c&gt;
    Listen 443
&lt;/IfModule&gt;</pre>
<p>Inside the virtual host or <code>httpd.conf</code> configuration file add the lines similar to the following:</p>
<pre>&lt;VirtualHost _default_:443&gt;
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/server.crt
    SSLCertificateKeyFile /etc/apache2/ssl/server.key
&lt;/VirtualHost&gt;</pre>
<p><strong>Redirecting HTTP traffic to HTTPS</strong></p>
<p>If you want to force users to use HTTPS, you can redirect all HTTP traffic to the HTTPS site.</p>
<p>Enable URL rewrite support by executing the following command:</p>
<p><code>$ a2enmod rewrite</code></p>
<p>In the virtual host or httpd.conf configuration file add the following three lines under the <code>&lt;VirtualHost *:80&gt;</code> line:</p>
<pre>RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}</pre>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/06/apache-log-file-rotation' rel='bookmark' title='Permanent Link: Apache Log File Rotation'>Apache Log File Rotation</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Tomcat and Apache with mod_jk Connector</title>
		<link>https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector</link>
		<comments>https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector#comments</comments>
		<pubDate>Fri, 08 Jun 2007 16:09:13 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=101</guid>
		<description><![CDATA[Using the mod_jk connector is an alternative but more complex method of integrating Tomcat and Apache together. The concept behind this method is to have Apache serve the static content of the website, and Tomcat to serve the Java related content. This could be a better alternative if your website contains mostly HTML pages. The [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Using the <code>mod_jk</code> connector is an alternative but more complex method of integrating Tomcat and Apache together. The concept behind this method is to have Apache serve the static content of the website, and Tomcat to serve the Java related content. This could be a better alternative if your website contains mostly HTML pages.</p>
<p>The <code>mod_jk</code> connector along with <code>mod_proxy_ajp</code> are the only recommend methods of Tomcat and Apache integration. <code>mod_jk</code> is still actively under development, and is very stable for production servers, as well it supports both Apache 1.3, and 2.x. Other past alternatives like <code>mod_webapp</code>, <code>mod_jserv</code>, <code>mod_jk2 </code>are not longer supported and are consider deprecated.</p>
<p><strong><code>mod_jk</code> Package Issue for Ubuntu</strong></p>
<p>For Ubuntu 7.04 there is an error in the <code>mod_jk</code> package. It currently has two packages for <code>mod_jk</code>:</p>
<ul>
<li><code>libapache-mod-jk</code> which depends on apache</li>
<li><code>libapache2-mod-jk2</code> which depends on apache2</li>
</ul>
<p>As mention previously, <code>mod_jk2</code> is already deprecated and <code>mod_jk</code> works for both Apache 1.3, and 2.x.</p>
<p>To properly configure Tomcat and Apache to use <code>mod_jk</code> the connector must be manually, build and set up from the source.</p>
<p><strong>Installing and Configuring <code>mod_jk</code></strong></p>
<p>Download and extract the latest connector from the Tomcat website <a title="http://tomcat.apache.org/download-connectors.cgi" href="http://tomcat.apache.org/download-connectors.cgi">http://tomcat.apache.org/download-connectors.cgi</a>, then configure and build it:</p>
<pre>$ cd tomcat-connectors-1.2.23-src/native
$ ./buildconf.sh
$ ./configure --with-apxs=/usr/bin/apxs2
$ make; make install</pre>
<p>Verify the <code>mod_jk.so</code> module exist in the apache module directory <code>/usr/lib/apache2/module</code>.</p>
<p><em>Note: </em>The programs are required to configure and build the connector: <code>automake</code>, <code>autoconf</code>, <code>libtoolize</code>, and <code>apxs2</code>. To obtain these programs install the following packages in Ubuntu: <code>libtool</code>, <code>automake</code>, and <code>apache2-threaded-dev</code></p>
<p><strong><em><code>libtool</code> error when compiling</em></strong></p>
<p>On some systems the <code>'make'</code> command will fail with the following error:</p>
<pre>libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'</pre>
<p>This is due to <code>libtool</code> not using the correct <code>gcc</code> when compiling. A workaround would be to add the parameter <code>'--tag CXX'</code> inside the <code>Makefile</code>.</p>
<pre>$ cd  tomcat-connectors-1.2.23-src/native/common
$ nano Makefile</pre>
<p>Inside the Makefile the change line from:</p>
<p><code>LIBTOOL = /usr/share/apr-1.0/build/libtool --silent</code></p>
<p>to:</p>
<p><code>LIBTOOL = /usr/share/apr-1.0/build/libtool --silent --tag CXX</code></p>
<p><strong>Creating the <code>workers.properties</code></strong></p>
<p>Create a <code>workers.properties</code> file in the Apache configuration directory and add the following lines to it.</p>
<p><code>$ nano /etc/apache2/workers.properties</code></p>
<pre># This file provides minimal jk configuration properties needed to
# connect to Tomcat.
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/lib/java-1.5.0-sun
ps=/
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.default.port=8009
worker.default.host=localhost
worker.default.type=ajp13
worker.default.lbfactor=1</pre>
<p><strong>Configure Apache for <code>mod_jk</code></strong></p>
<p>Create the jk module configuration files for Apache</p>
<p><code>$ nano /etc/apache2/mods-available/jk.load</code></p>
<p><code>LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so</code></p>
<p><code>$ nano /etc/apache2/mods-available/jk.conf</code></p>
<pre>&lt;IfModule mod_jk.c&gt;
    # Where to find workers.properties
    JkWorkersFile /etc/apache2/workers.properties</pre>
<pre>    # Where to put jk logs
    JkLogFile /var/log/apache2/mod_jk.log

    # Set the jk log level [debug/error/info]
    JkLogLevel info

    # Select the log format
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

    # JkOptions indicate to send SSL KEY SIZE,
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

    # JkRequestLogFormat set the request format
    JkRequestLogFormat "%w %V %T"

    # Globally deny access to the WEB-INF directory
    &lt;LocationMatch '.*WEB-INF.*' &gt;
         Order deny,allow
         Deny from all
    &lt;/LocationMatch&gt;
&lt;/IfModule&gt;</pre>
<p>After creating the configuration files you can now enable the jk module for Apache</p>
<p><code>$ a2enmod jk</code></p>
<p><strong>Sending JSP and Servlets through <code>mod_jk</code></strong></p>
<p>Inside the virtual host you can mount JSP and Servlet context to the worker define in the <code>workers.properties</code> file. For example to mount the JSP and Servlet examples from Tomcat add the following lines:</p>
<pre>JkMount /jsp-examples/*.jsp worker1
JkMount /servlets-examples/servlet/* worker1</pre>
<p><strong>Apache <code>DirectoryIndex</code></strong></p>
<p>If your website uses <code>index.jsp</code> it must be download inside the <code>DirectoryIndex</code> of Apache. Modified the file <code>/etc/apache2/mods-enabled/dir.conf</code> and add <code>index.jsp</code> to the list.</p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2008/11/problem-using-mysql-jdbc-on-tomcat-55-and-ubuntu-804' rel='bookmark' title='Permanent Link: Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04'>Problem using MySQL JDBC on Tomcat 5.5 and Ubuntu 8.04</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache Log File Rotation</title>
		<link>https://www.vincentkong.com/2007/06/apache-log-file-rotation</link>
		<comments>https://www.vincentkong.com/2007/06/apache-log-file-rotation#comments</comments>
		<pubDate>Fri, 01 Jun 2007 15:33:16 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=82</guid>
		<description><![CDATA[The log files for Apache can typically grow very large, and it sometimes necessary to periodically rotate the log files by moving or deleting the existing logs. Apache is capable of writing log files through a pipe to another process, rather than directly to a file. This allows log to be rotated without restarting Apache. [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The log files for Apache can typically grow very large, and it sometimes necessary to periodically rotate the log files by moving or deleting the existing logs. Apache is capable of writing log files through a pipe to another process, rather than directly to a file. This allows log to be rotated without restarting Apache.</p>
<p><strong>rotatelogs</strong></p>
<p>The Apache HTTP Server includes a simple program called <code>rotatelogs</code> for log rotation. In Ubuntu this program can be found in <code>/usr/sbin/rotatelogs</code>.</p>
<p>The following is a simple configuration to setup log rotation in Apache:</p>
<p><code>CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/access.log 86400" common</code></p>
<p>This configuration rotates the access log file every 24 hours.</p>
<p><code>CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/access.log 5M" common</code></p>
<p>This configuration Rotates the access log file whenever it reaches 5MB.</p>
<p><code>ErrorLog "|/usr/sbin/rotatelogs /var/log/apache2/error.log.%Y-%m-%d-%H_%M_%S 5M"<br />
</code></p>
<p>This configuration will rotate the error log file whenever it reaches 5MB, and add the suffix to the log file name in the form of<code> error.log.YYYY-mm-dd-HH_MM_SS</code>.</p>
<p>For more information on <code>rotatelogs</code> refer to <a title="http://httpd.apache.org/docs/2.2/programs/rotatelogs.html" href="http://httpd.apache.org/docs/2.2/programs/rotatelogs.html">http://httpd.apache.org/docs/2.2/programs/rotatelogs.html</a></p>
<p><strong>cronolog</strong></p>
<p>Cronolog is a similar more flexible log rotation program. It rotates log files specify by the filename template and the current date and time.</p>
<p>To install <code>cronolog</code>:</p>
<p>$<code> apt-get install cronolog</code></p>
<p>The configuration below rotates the log files on a daily basis:</p>
<pre>CustomLog "|/usr/bin/cronolog /var/log/apache2/access.log.%Y-%m-%d"
ErrorLog  "|/usr/bin/cronolog /var/log/apache2/errors.log.%Y-%m-%d"</pre>
<p>To rotate the log file on a monthly basis the configuration would be:</p>
<pre>CustomLog "|/usr/bin/cronolog /var/log/apache2/access.log.%Y-%m"</pre>
<p>For more information on cronolog refer to <a title="http://cronolog.org/" href="http://cronolog.org/">http://cronolog.org/</a></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/06/apache-log-file-rotation/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Tomcat and Apache Using Proxy</title>
		<link>https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy</link>
		<comments>https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy#comments</comments>
		<pubDate>Wed, 30 May 2007 16:07:30 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=100</guid>
		<description><![CDATA[This easiest way to integrate Tomcat and Apache together is to have Tomcat run behind Apache which behaves like a proxy server. Enable the proxy module for Apache. $ a2enmod proxy $ a2enmod proxy_http (To allow Apache to forward to Tomcat HTTP Connector) Include the following in the Apache configuration file: ServerName tomcat.example.com ProxyPass / [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy' rel='bookmark' title='Permanent Link: Apache mod_proxy and Reverse Proxy'>Apache mod_proxy and Reverse Proxy</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This easiest way to integrate Tomcat and Apache together is to have Tomcat run behind Apache which behaves like a proxy server.</p>
<p>Enable the proxy module for Apache.</p>
<p><code>$ a2enmod proxy</code> <code><br />
$ a2enmod proxy_http</code> (To allow Apache to forward to Tomcat HTTP Connector)</p>
<p>Include the following in the Apache configuration file:</p>
<pre>ServerName tomcat.example.com</pre>
<pre>ProxyPass / http://localhost:8080/
ProxyPassReverse  /  http://localhost:8080/</pre>
<p>The above example tells Apache to forward URLs from http://tomcat.example.com/* to Tomcat&#8217;s Http Connector which is setup to be listening on port 8080 and assumes that you have setup a virtual host in Tomcat for tomcat.example.com.</p>
<p>When you are running behind a proxy server, you will sometimes prefer to manage the values returned by:</p>
<ul>
<li><code>ServletRequest.getServerName()</code>: Returns the host name of the server to which the request was sent.</li>
<li><code>ServletRequest.getServerPort()</code>: Returns the host name of the server to which the request was sent.</li>
</ul>
<p>In general, you may want the port number to reflect that specified in the original request, not the one on which the HTTP Connector itself is listening. You can use the <code>proxyName</code> and <code>proxyPort</code> attributes on the <code>&lt;Connector&gt; </code>element to configure these values.</p>
<p>In the <code>server.xml</code> you can uncomment the line similar to the one below, if you still want to keep the HTTP Connector to continue listening on 8080.</p>
<pre>&lt;Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyName="www.mycompany.com"
proxyPort="80" disableUploadTimeout="true" /&gt;</pre>
<p>After you have restarted Tomcat, <code>ServletRequest.getServerName()</code>, and <code>ServletRequest.getServerPort()</code> will return <code>www.mycompany.com</code> and <code>80</code> respectively.</p>
<p><strong>Using the AJP Connector</strong></p>
<p>AJP is an optimized version of the HTTP protocol to allow a web server such as Apache talk to Tomcat. When integrating Tomcat with Apache, the AJP connector will provide faster performance than proxied HTTP.</p>
<p>Enable APJ proxy module in Apache:</p>
<p><code>$ a2enmod proxy_ajp </code></p>
<p>In the Apache configuration file add the following:</p>
<pre>ProxyPass / ajp://localhost:8009/
ProxyPassReverse  /  ajp://localhost:8009/</pre>
<p>The default port used by the AJP connector in Tomcat is 8009, and can be enable using the following line inside the <code>server.xml</code> file.</p>
<p><code>&lt;Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /&gt;</code></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy' rel='bookmark' title='Permanent Link: Apache mod_proxy and Reverse Proxy'>Apache mod_proxy and Reverse Proxy</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache mod_proxy and Reverse Proxy</title>
		<link>https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy</link>
		<comments>https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy#comments</comments>
		<pubDate>Fri, 25 May 2007 15:34:45 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=83</guid>
		<description><![CDATA[The mod_proxy module implements a proxy/gateway for Apache. It implements proxying capability for several different protocols and are divided into additional modules: mod_proxy_http, mod_proxy_ftp, mod_proxy_ajp, mod_proxy_balancer, and mod_proxy_connect. Apache can be configured in both a forward and reverse proxy mode. Only reverse proxy will be discussed in this section. A reverse proxy is a gateway [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>The mod_proxy module implements a proxy/gateway for Apache. It implements proxying capability for several different protocols and are divided into additional modules: <code>mod_proxy_http</code>, <code>mod_proxy_ftp</code>, <code>mod_proxy_ajp</code>, <code>mod_proxy_balancer</code>, and <code>mod_proxy_connect</code>.</p>
<p>Apache can be configured in both a <em>forward</em> and <em>reverse</em> proxy mode. Only reverse proxy will be discussed in this section.</p>
<p>A reverse proxy is a gateway for servers, and enables one web server to provide content from another transparently.</p>
<p><em>Note: </em>A reverse proxy is activated using the <code class="directive">ProxyPass</code> directive. It is <strong>not</strong> necessary to turn <code class="directive">ProxyRequests</code> on in order to configure a reverse proxy.</p>
<p><strong>Setting Up Reverse Proxy</strong></p>
<p>Enable the <code>mod_proxy</code> module</p>
<p><code>$ a2enmod proxy</code></p>
<p>Enable the <code>mod_proxy_http</code> module if you are going to proxy to a <code>http</code> protocol</p>
<p><code>$ a2enmod proxy_http</code></p>
<p>Add the following to the <code>/etc/apache2/httpd.conf</code> or a virtual host site in <code>/etc/apache2/sites-available</code>:</p>
<pre>ProxyRequests Off
&lt;Proxy *&gt;
    Order deny,allow
    Allow from all
&lt;/Proxy&gt;</pre>
<pre>ProxyPreserveHost on
ProxyPass /foo http://foo.example.com/bar
ProxyPassReverse /foo http://foo.example.com/bar</pre>
<p>For more information on mod_proxy refer to the Apache documentation at <a href="http://httpd.apache.org/docs/2.2/mod/mod_proxy.html">http://httpd.apache.org/docs/2.2/mod/mod_proxy.html</a></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/05/integrating-tomcat-and-apache-using-proxy' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache Using Proxy'>Integrating Tomcat and Apache Using Proxy</a></li>
<li><a href='https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Apache for Ubuntu Quickstart Guide'>Apache for Ubuntu Quickstart Guide</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/05/apache-mod_proxy-and-reverse-proxy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache for Ubuntu Quickstart Guide</title>
		<link>https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide</link>
		<comments>https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide#comments</comments>
		<pubDate>Mon, 14 May 2007 15:28:46 +0000</pubDate>
		<dc:creator>Vincent Kong</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://wordpress.vincentkong.com/?p=80</guid>
		<description><![CDATA[Apache is the world&#8217;s most popular web server, and is developed and maintain by an open community of developers under the Apache Software Foundation. Installing Apache for Ubuntu From the Ubuntu desktop: Go to System &#62; Administration &#62; Synapatic Package Manager Search for &#8220;apache2&#8243; and &#8220;Mark for installation&#8221; Click on the &#8220;Apply&#8221; to install From [...]


Related posts:<ol><li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Apache is the world&#8217;s most popular web server, and is developed and maintain by an open community of developers under the <a title="Apache Software Foundation" href="http://www.apache.org/">Apache Software Foundation</a>.</p>
<p><strong>Installing Apache for Ubuntu</strong><br />
<strong></strong></p>
<p>From the Ubuntu desktop:</p>
<ol>
<li>Go to System &gt; Administration &gt; Synapatic Package Manager</li>
<li>Search for &#8220;apache2&#8243; and &#8220;Mark for installation&#8221;</li>
<li>Click on the &#8220;Apply&#8221; to install</li>
</ol>
<p>From the command line:</p>
<p><code>$ sudo apt-get install apache2</code></p>
<p><strong>Apache Directories</strong><strong> for Ubuntu </strong></p>
<ul>
<li><code>/etc/apache2</code> This directory contains the Apache configuration files.</li>
<li><code>/etc/init.d</code> The startup script <code>apache2</code> can be found in this directory. This script is used to start and stop the server. It also, automatically starts and stops the server when it&#8217;s halted, started, or rebooted.</li>
<li><code>/var/www</code> The default location for the web content.</li>
<li><code>/usr/sbin</code> The executable programs are placed in this directory. For example: <code>apache2</code> the server executeable itself.</li>
<li><code>/usr/bin</code> Some of the utilities from Apache package are placed here. For example: <code>htpasswd</code>, used for generating authentication password files.</li>
</ul>
<p><strong>Configuration Files</strong></p>
<p>The configuration files for Apache is under the directory <code>/etc/apache2</code>.</p>
<ul>
<li><code>apache2.conf</code> This is the file which contains all the default configurations of the web server. Inside the configuration file it also loads configurations from: <code>mods-enabled/*.load</code>, <code>mods-enabled/*.conf</code>, <code>httpd.conf</code>, <code>ports.conf</code>, <code>conf.d/</code>, and <code>sites-enabled/</code></li>
<li><code>mods-available</code> This directory contains all the configurations for all the available modules in Apache</li>
<li><code>mods-enabled</code> This directory contains all the configurations for the modules enable in Apache</li>
<li><code>httpd.conf</code> This file is original and should contain custom configuration specifically for your web server. e.g. ServerName</li>
<li><code>ports.conf</code> This file contains a list of all the ports the web server should be listening to.</li>
<li><code>sites-available</code> This directory should contain all the configurations for your websites being hosted on the webserver</li>
<li><code>sites-enabled</code> This directory should contains the configurations for your websites that you have enabled on the web server.</li>
</ul>
<p><strong>Starting and Stopping Apache</strong></p>
<p>The <code>/etc/init.d/apache2</code> script and the following options is use to control the web server:</p>
<ul>
<li><code>start</code> Start the web server.</li>
<li><code>stop</code> Stops the web server.</li>
<li><code>reload</code> Reload the configuration files after modification.</li>
<li><code>restart</code> Convenient way to stop and then immediately start the web server.</li>
</ul>
<p><strong>Virtual Hosting</strong></p>
<p>Virtual hosts enable you to run more than one host on the same IP address. To enable virtual host you can modified the <code>httpd.conf</code> file:</p>
<p><code>NameVirtualHost 192.168.100.1</code></p>
<p><code>&lt;VirtualHost 192.168.100.1&gt;<br />
ServerName www.vincentkong.com<br />
ServerAlias vincentkong.com<br />
</code></p>
<p><code> CustomLog /path/to/logfile/access.log combined<br />
ErrorLog /path/to/logfile/error.log</code></p>
<p><code> DocumentRoot /path/to/website/<br />
&lt;Directory /path/to/website/&gt;<br />
Options Indexes FollowSymLinks MultiViews<br />
AllowOverride None<br />
allow from all<br />
&lt;/Directory&gt;<br />
&lt;/VirtualHost&gt;</code><strong></strong></p>
<p><strong>Options Directives</strong></p>
<p>Options directives determines what options are available for the directory configured in Apache.</p>
<table border="1">
<tbody>
<tr>
<td><strong>Switch</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td><code>None</code></td>
<td>None of the available options are enabled for this directory.</td>
</tr>
<tr>
<td><code>All</code></td>
<td>All the options, except for <code>MultiViews</code>, are enabled for this directory.</td>
</tr>
<tr>
<td><code>Indexes</code></td>
<td>If the <code>index.html</code> or other <code>DirectoryIndex</code> file is missing, then list the files in the directory as an HTML page.</td>
</tr>
<tr>
<td><code>Includes</code></td>
<td>Server-side includes (SSI) are permitted in this directory. Can also be <code>IncludesNoExec</code> if you want to allow includes but don&#8217;t allow <code>exec</code> option.</td>
</tr>
<tr>
<td><code>FollowSymLinks</code></td>
<td>Allows access to directories that are symbolically linked to a document directory.</td>
</tr>
<tr>
<td><code>ExecCGI</code></td>
<td>CGI programs are permitted in this directory.</td>
</tr>
<tr>
<td><code>MultiViews</code></td>
<td>Part of <code>mod_negotiation</code> module. When a client requests document that can&#8217;t be found, the server tries to figure out which document best suits the client&#8217;s requirements.</td>
</tr>
</tbody>
</table>
<p><strong>Enabling/Disabling Multiple Sites</strong></p>
<p>There are two commands which allows you to easily enable/disable multiple websites. For each website create a file in the <code>/etc/apache2/sites-available</code> directory (it&#8217;s perferable that the file name is the name of your site) e.g. vincentkong.com, and add in your virtual host settings.</p>
<p>To enable the website use the command:</p>
<p><code>$ a2ensite &lt;site filename&gt;</code></p>
<p>This command will create a symbolic link inside the <code>/etc/apache2/sites-enabled</code> directory to your file.</p>
<p>To disable the website use the command:</p>
<p><code>$ a2dissite &lt;site filename&gt; </code></p>
<p><strong>Enabling/Disabling Modules</strong></p>
<p>All the configuration files for the modules installed with Apache can be found in <code>/etc/apache2/mods-available</code>, the <code>.load</code> file are the settings to load the module, and the <code>.conf</code> are the default settings for the module.</p>
<p>To enable a module for Apache use the following command:</p>
<p><code>$ a2enmod</code> or</p>
<p><code>$ a2enmod &lt;module name&gt;</code> (if you already know the name of the module)</p>
<p>This command basically creates a symbolic link in the <code>mods-enabled</code> directory to the module configuration you specified.</p>
<p>To disable a module use the command:</p>
<p><code>$ a2dismod</code></p>


<p>Related posts:<ol><li><a href='https://www.vincentkong.com/2007/06/integrating-tomcat-and-apache-with-mod_jk-connector' rel='bookmark' title='Permanent Link: Integrating Tomcat and Apache with mod_jk Connector'>Integrating Tomcat and Apache with mod_jk Connector</a></li>
<li><a href='https://www.vincentkong.com/2007/06/configuring-apache-for-ssl-support' rel='bookmark' title='Permanent Link: Configuring Apache for SSL Support'>Configuring Apache for SSL Support</a></li>
<li><a href='https://www.vincentkong.com/2007/05/tomcat-55-for-ubuntu-quickstart-guide' rel='bookmark' title='Permanent Link: Tomcat 5.5 for Ubuntu Quickstart Guide'>Tomcat 5.5 for Ubuntu Quickstart Guide</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>https://www.vincentkong.com/2007/05/apache-for-ubuntu-quickstart-guide/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
