<?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>Thoughts Electrique &#187; Apache</title>
	<atom:link href="http://www.sebastian.himberger.de/blog/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sebastian.himberger.de/blog</link>
	<description>Sebastian Himbergers blog about technology and software development</description>
	<lastBuildDate>Sat, 16 Jul 2011 22:48:45 +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>Custom php.ini and URL rewriting in Plesk 9 with fastcgi</title>
		<link>http://www.sebastian.himberger.de/blog/2009/03/19/custom-phpini-and-url-rewriting-in-plesk-9-with-fastcgi/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/03/19/custom-phpini-and-url-rewriting-in-plesk-9-with-fastcgi/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 17:43:42 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=366</guid>
		<description><![CDATA[For a current hosting server I&#8217;m using the Plesk control panel 9.0.1 for Ubuntu 8.04. Since version 9 Plesk allows the usage of Postfix as an MTA and PHP via FastCGI. This is very nice and much more secure than the old model using mod_php. The Problem One problem with the current Plesk version (as [...]]]></description>
			<content:encoded><![CDATA[<p>For a current hosting server I&#8217;m using the <a title="Official Plesk website" href="http://www.parallels.com/de/products/plesk/" target="_blank">Plesk control panel 9.0.1</a> for Ubuntu 8.04. Since version 9 Plesk allows the usage of <a title="Postfix website" href="http://www.postfix.org/" target="_blank">Postfix</a> as an <a title="Mail Transfer Agent explain at Wikipedia" href="http://en.wikipedia.org/wiki/Mail_Transfer_Agent" target="_blank">MTA</a> and PHP via <a title="FastCGI website" href="http://www.fastcgi.com/" target="_blank">FastCGI</a>. This is very nice and much more secure than the old model using mod_php.</p>
<h3>The Problem</h3>
<p>One problem with the current Plesk version (as with most Plesk versions :/) is that it has some nasty bugs. For example mod_rewrite doesn&#8217;t work with the FastCGI configuration. The problem is that the generated virtual host configuration has a small but important problem. The generated host looks something like this:</p>
<pre class="file">&lt;VirtualHost 88.198.164.10:80&gt;
  ServerName   playground.himberger.de:80
  ServerAlias  www.playground.himberger.de

  &lt;IfModule mod_fcgid.c&gt;
    &lt;Files ~ (\.php)&gt;
      SetHandler fcgid-script
      FCGIWrapper /usr/bin/php5-cgi .php
<strong>      Options ExecCGI</strong>
      allow from all
    &lt;/Files&gt;
  &lt;/IfModule&gt;
&lt;/VirtualHost&gt;</pre>
<p>The issue with this configuration is the line &#8220;<strong>Options ExecCGI</strong>&#8220;. This line enables the execution of CGI scripts for this particular directory but overrides all the Options set earlier. These are in parts needed for mod_rewrite. To fix this the line should be &#8220;<strong>Options +ExecCGI</strong>&#8220;. Sadly changing the configuration doesn&#8217;t help because at the next opportunity Plesk will regenerate the config file and your change is gone.</p>
<p>Luckily there is a way around this&#8230;</p>
<p><span id="more-366"></span></p>
<h3>Enable mod_rewrite (the solution)</h3>
<p>Luckily Plesk allows you to append a custom configuration to the virtual host by creating a file <em>vhost.conf</em> in the <em>${yourvhost}/conf</em> directory. By putting the following config in your <em>vhost.conf</em> you can take back the overwritten Options (don&#8217;t forget to restart the Apache HTTPD).</p>
<pre class="file">&lt;Directory "/var/www/vhosts/${yourvhost}/httpdocs"&gt;
  &lt;Files ~ (\.php)&gt;
    Options All
  &lt;/Files&gt;
&lt;/Directory&gt;</pre>
<p>You have to be very specific (using the enclosing Directory directive) to cause the current setting to be overridden.</p>
<p>With this knowledge at hand we can do some other nice tricks.</p>
<h3>Using a custom php.ini with fastcgi</h3>
<p>Since we are now able to override the Plesk generated configuration we can also alter the fastcgi command and for example specify a custom php.ini:</p>
<pre class="file">&lt;Directory "/var/www/vhosts/${yourvhost}/httpdocs"&gt;
  &lt;Files ~ (\.php)&gt;
   <strong> FCGIWrapper "/usr/bin/php5-cgi -c /etc/phpconfigs/${yourvhost}"  .php</strong>
    Options All
  &lt;/Files&gt;
&lt;/Directory&gt;</pre>
<p>The <strong><strong>FCGIWrapper</strong></strong> command will use the directory specified with the <em>-c</em> parameter for it&#8217;s php configuration. Simply put your php.ini in this directory and it will automatically be picked up. This way you can easily use a per customer PHP configuration with fastcgi and Plesk.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/03/19/custom-phpini-and-url-rewriting-in-plesk-9-with-fastcgi/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OpenCms Apache integration: The simplest solution</title>
		<link>http://www.sebastian.himberger.de/blog/2009/03/11/opencms-apache-integration-the-simplest-solution/</link>
		<comments>http://www.sebastian.himberger.de/blog/2009/03/11/opencms-apache-integration-the-simplest-solution/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 17:28:09 +0000</pubDate>
		<dc:creator>Sebastian</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[OpenCms]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.sebastian.himberger.de/blog/?p=353</guid>
		<description><![CDATA[My OpenCms Apache Integration Howto for OpenCms 6 still get&#8217;s a lot of visitors. Many things have changed since I first wrote this howto and certainly things are a lot easier now. I always wanted to rewrite the howto but till then I will just publish a short update on how to integrate OpenCms 7 [...]]]></description>
			<content:encoded><![CDATA[<p>My <a title="OpenCms Apache Integration Howto" href="/comp/tutorials/opencms/apache-integration/" target="_blank">OpenCms Apache Integration Howto for OpenCms 6</a> still get&#8217;s a lot of visitors. Many things have changed since I first wrote this howto and certainly things are a lot easier now. I always wanted to rewrite the howto but till then I will just publish a short update on how to integrate OpenCms 7 with Apache and to remove the <em>/opencms</em> prefix with the most recent software.</p>
<p><span id="more-353"></span></p>
<h3>Prerequisites</h3>
<ul>
<li>OpenCms 7 (already installed)</li>
<li>Apache HTTPD 2.2 with mod_proxy_ajp</li>
<li>Apache Tomcat 5.5+</li>
</ul>
<h3>Goal of the setup</h3>
<ul>
<li>Dynamic content served from http://www.yourdomain.com/</li>
<li>Static content served from http://www.yourdomain.com/opencms/export/</li>
</ul>
<h3>Steps to perform</h3>
<h4>Configure Tomcat</h4>
<p>As described in the Howto you have to add the <em>emptySessionPath=&#8221;true&#8221;</em> attribute to the Tomcat AJP Connector in the <em>server.xml</em>:</p>
<pre class="file">&lt;Connector <strong>emptySessionPath="true"</strong> port="8009" protocol="AJP/1.3" /&gt;</pre>
<h4>Configure OpenCms</h4>
<p>You have to modify the <em>opencms-importexport.xml</em> configuration file. But beware the <em>&lt;rfs-prefix&gt;</em> doesn&#8217;t need changing anymore. In fact: Things won&#8217;t work if you change it the old way. These are the settings you want.</p>
<pre class="file">       &lt;rfs-prefix&gt;${CONTEXT_NAME}/export&lt;/rfs-prefix&gt;
       &lt;vfs-prefix&gt;&lt;/vfs-prefix&gt;</pre>
<p>Don&#8217;t forget to restart OpenCms.</p>
<h4>Configure Apache HTTPD</h4>
<p>Since the AJP Connector is now integrated in mod_proxy you don&#8217;t need the (stupid) rewrite rules anymore. I also got rid of the fact that static content is served from Apache. This has several reasons:</p>
<ol>
<li>The new Tomcat is fast enough to serve static content itself. Espcecially with the NIO / APR Connector.</li>
<li>If you ever want to move the Tomcat to a different machine and use Apache HTTPD as a simple load balancer things get a lot easier if Apache doesn&#8217;t need access to the web application files.</li>
</ol>
<p>Here&#8217;s an example virtual host:</p>
<pre class="file">&lt;VirtualHost *:80&gt;

  ServerName yourdomain.com
  DocumentRoot /some/directory

  &lt;Proxy ajp://localhost:8009*&gt;
     Allow from all
  &lt;/Proxy&gt;

  ProxyPass        /opencms/   ajp://localhost:8009/opencms/
  ProxyPassReverse /opencms/   ajp://localhost:8009/opencms/

  ProxyPass /          ajp://localhost:8009/opencms/opencms/
  ProxyPassReverse /   ajp://localhost:8009/opencms/opencms/

&lt;/VirtualHost&gt;</pre>
<p>This is it. Don&#8217;t hesitate to ask questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian.himberger.de/blog/2009/03/11/opencms-apache-integration-the-simplest-solution/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
	</channel>
</rss>

