<?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>Code Penguin &#187; Sysadmin</title>
	<atom:link href="http://laurent.bachelier.name/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://laurent.bachelier.name</link>
	<description>Musings on software, internet and technology by Laurent Bachelier</description>
	<lastBuildDate>Thu, 16 Jun 2011 20:27:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Some clarifications on symfttpd</title>
		<link>http://laurent.bachelier.name/2011/03/some-clarifications-on-symfttpd/</link>
		<comments>http://laurent.bachelier.name/2011/03/some-clarifications-on-symfttpd/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 18:24:15 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=267</guid>
		<description><![CDATA[The basic idea is to start a server without any central configuration to maintain, and no need for any root access, hence generic virtual hosts features of Apache or lighttpd are not complete alternatives, as they at least require editing /etc/hosts. It uses the FastCGI backend (or &#8220;SAPI&#8221;) and can by default handle 3 concurrent [...]]]></description>
			<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:30364a44b1994a1c50b606c2b8fdf1711e44bc58'><p>The basic idea is to start a server without any central configuration to maintain, and no need for any root access, hence generic virtual hosts features of Apache or lighttpd are not complete alternatives, as they at least require editing <code>/etc/hosts</code>.</p>
<p>It uses the FastCGI backend (or &#8220;SAPI&#8221;) and can by default handle 3 concurrent requests, which is more than enough for development. On the production side, I only use symfttpd to generate the rewrite rules (since lighttpd is also my production server of choice). If you have an opcode cache installed (for instance APC or xcache), it will be used, as fastcgi processes are seldom restarted (by default every 100 requests, I use a higher number on production though). It also does not rely on any hacks to simulate a web request in the CLI: you are doing real requests using a real PHP HTTP backend.</p>
<p>One of the future improvements could be using <a href="http://php.net/manual/en/install.fpm.php">FPM</a> instead of FastCGI.</p>
<p><a href="https://github.com/laurentb/symfttpd">Symfttpd</a> can optionality use the <code><a href="http://php.net/manual/en/function.pcntl-fork.php">fork</a></code> function to provide two nice features: automatically restart when rewriting rules change, and display the access and error log. However, if you do not have fork support compiled in (it is enabled by default in at least Gentoo, Debian and Ubuntu), it does not mean only one request can be answered at a time (<a href="http://www.lighttpd.net/">lighttpd</a> does not need <code>fork()</code> by the way, which is one of the reasons it is very fast).</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2011/03/some-clarifications-on-symfttpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>chmod 777 is evil</title>
		<link>http://laurent.bachelier.name/2010/07/chmod-777-is-evil/</link>
		<comments>http://laurent.bachelier.name/2010/07/chmod-777-is-evil/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 08:07:20 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=131</guid>
		<description><![CDATA[Well, chmod 666 is the true evil obviously, but people who use the chmod 777 trick really don&#8217;t want to bother with the different signification of x for files and folders, so they mark all files as executables. This makes ls in my terminal quite ugly, and is what motivated me to write yet another [...]]]></description>
			<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:5a49026651bd08aa4e816c1360225ee63973fc01'><p>Well, chmod 666 is the true evil obviously, but people who use the <em>chmod 777 trick</em> really don&#8217;t want to bother with the different signification of <code>x</code> for files and folders, so they mark all files as executables. This makes <code>ls</code> in my terminal quite ugly, and is what motivated me to write yet another rant!</p>
<p>Traditionally, the web server runs with a special, underprivileged user. Now, this is totally fine — I&#8217;ll get back to that later. However, when a developer starts a project, he naturally does it with his own account. This is fine, too. When he wants to test it, he installs a web server (let&#8217;s say Apache and mod_php<sup><a href="http://laurent.bachelier.name/2010/07/chmod-777-is-evil/#footnote_0_131" id="identifier_0_131" class="footnote-link footnote-identifier-link" title="I don&#039;t like much both of them, but more on that later">1</a></sup>), and tells the web server to use the project directory. However, the web server&#8217;s user can&#8217;t read, or at least can&#8217;t write in the directory. And here, our web developers asking for help gets recommended to &#8220;chmod 777&#8243;. Symfony even has a command for doing it, and it is a real shame.</p>
<p>It will work. It will also make an ugly git commit, and an ugly <code>ls</code>. Il will create files owned by the web server, and the developer is likely to use <code>sudo</code> before every command to work around the problems that will ensue, and it just gets insane.</p>
<p>Separation of privileges is what makes UNIX systems great. Let&#8217;s understand them and use them, please.</p>
<p>The obvious solution here is to run your development server under the development user. There is no need to separate when it&#8217;s for your own usage. There is a even better solution, embraced by almost every language but PHP: a way to start a web server on demand. I believe it was started by Ruby on Rails with WEBrick, and now every non-PHP framework has it. Python, by using <a href="http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface">WSGI</a> makes it very easy. I simulated this feature for Symfony by writing <a href="http://laurent.bachelier.name/2010/05/reducing-the-gap-between-symfony-and-non-php-frameworks/">symfttpd</a>. It&#8217;s actually simpler for the developer as there is no configuration or installation at all.</p>
<p>Enough about developers; it&#8217;s not their job to setup daemons and manage UNIX systems. Let&#8217;s talk about the real accomplices of the Devil: system administrators.</p>
<p>Yes, there are system administrators that don&#8217;t use permissions properly. And they are legion. I&#8217;ve seen horrors, up to &#8220;sudo svn up&#8221; on the production server, because half the files ended being owned by root. And then &#8220;chmod 777&#8243; on millions of files.</p>
<p>There are many solutions there; group inheritance with the <a href="http://en.wikipedia.org/wiki/Setuid#setuid_and_setgid_on_directories">setgid bit</a>, forcing the users to <code>su</code> as the web server user, or a deployment script (I&#8217;ve used the three of them for different situations).</p>
<p>Why is this important? Because it is often useful to separate users (one should not have access to the other&#8217;s projects in reading or writing), or to separate projects for security (one hacked project should not give access to the others).</p>
<p>I&#8217;ve seen it… done wrong:</p>
<ul>
<li>safe_mode for PHP. It doesn&#8217;t work and will disappear in newer versions anyway.</li>
<li>Only allowing FTP access to users, who can still upload a PHP script which will have access to everything (if run through the web server). Oh, and FTP sucks. Same issue with SSH and chroot.</li>
<li>Add the users to the <em>group</em> the web server is running as. Allows SSH access. Nice, but the PHP script trick will, again, defeat it.</li>
</ul>
<p>There is only one solution: use the &#8220;group&#8221; solution, but run a different PHP instance for each user. It is quite rarely used because the convenience of <em>Apache</em> and <em>mod_php</em>. But running PHP in the same <em>process</em> as the web server feels quite dangerous for me too. I think <em>mod_php</em> is an abomination.</p>
<p>I&#8217;ve done it for years with <em>Lighttpd</em>, <em>PHP</em> and <em>FastCGI</em> with a few alterations to Gentoo&#8217;s <code>spawn-fgci</code> init script (which is now able to handle multiple configurations without any alteration since a few months). My setup is very similar to <a href="http://redmine.lighttpd.net/wiki/lighttpd/HowToSetupFastCgiIndividualPermissions">that one</a>.</p>
<p>Note that while I mention PHP, this issue is not strictly related to PHP, yet seems widespread in PHP communities.</p>
<ol class="footnotes">
<li id="footnote_0_131" class="footnote">I don&#8217;t like much both of them, but more on that later</li>
</ol>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2010/07/chmod-777-is-evil/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Reducing the gap between Symfony and non-PHP frameworks</title>
		<link>http://laurent.bachelier.name/2010/05/reducing-the-gap-between-symfony-and-non-php-frameworks/</link>
		<comments>http://laurent.bachelier.name/2010/05/reducing-the-gap-between-symfony-and-non-php-frameworks/#comments</comments>
		<pubDate>Sun, 23 May 2010 23:01:09 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[symbolic links]]></category>
		<category><![CDATA[symfttpd]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=172</guid>
		<description><![CDATA[Something that always annoyed me is how tedious it is to install a Symfony project on a machine. Since I frequently need to intervene quickly on a project for work, and I was getting a brand-new machine, I really didn&#8217;t want to create an apache vhost (let alone install Apache: it&#8217;s painfully slow and its [...]]]></description>
			<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:dff9fd37718ad21821c464daf7fe8459d14517f6'><p>Something that always annoyed me is how tedious it is to install a Symfony project on a machine. Since I frequently need to intervene quickly on a project for work, and I was getting a brand-new machine, I really didn&#8217;t want to create an apache <em>vhost</em> (let alone install Apache: it&#8217;s painfully slow and its configuration is obscure and hard to debug), edit my <code>/etc/hosts</code> file, etc. for each project.</p>
<p>Moreover, developers are not system administrators and should not have to do complicated setups, especially when it turns out to be badly set up, and problems are &#8220;resolved&#8221; by &#8220;chmod 777&#8243; or &#8220;chmod 666&#8243; (which is indeed <a href="http://wordpress.org/development/2010/04/file-permissions/">evil</a>), a very sad but true practice promoted even by the developers of Symfony since there is a <code>symfony fix-perms</code><code> command that basically does that. It should have been named </code><code>symfony break-perms</code> or <code>symfony please-make-things-insecure-i-want-to-go-back-to-windows</code> or never been made.</p>
<p>On most non-PHP frameworks, there is a small embedded webserver that you can run on-demand. <strong>No configuration needed.</strong> Moreover, no special rights needed: a simple user can start it.</p>
<p>Since there was no such webserver written in PHP that was able to run Symfony properly, I chose to auto-configure <a href="http://www.lighttpd.net/">lighttpd</a> with a simple tool called <em>symfttpd</em>. The <code>genconf</code> tool was born.</p>
<p>However, I encountered another issue I didn&#8217;t think of before: for each project, I had to <strong>create symbolic links</strong> to the Symfony source code (another practice of the Symfony community, and there is no proper alternative in the PHP world). Hence, I created <code>mksymlinks</code>. For the developer, it is very simple to use: configure once on the machine, once per project, and that&#8217;s it.</p>
<p><code>genconf</code> only generates a configuration, which is still very practical for a system administrator; moreover it is flexible and well-tested. But it still required the develop to configure something, and there still was the rights problem.</p>
<p>Hence I created <code>spawn</code> which handles <strong>starting and stopping the webserver, just like non-PHP frameworks do</strong>. As a nice addition, it keeps server and PHP logs in the <code>log</code> folder of the project.</p>
<p><em>symfttpd</em> has even more uses; one I didn&#8217;t think of at first was that it can automate the installation of a project on a continuous integration platform, and can start a webserver for functional testing (both are used daily at work).</p>
<p>One of the most important aspects of <em>symfttpd</em> is that <strong>all tools are independent</strong>: you can use only <code>mksymlinks</code> or <code>genconf</code> (though <code>spawn</code> more or less requires the use of both, it isn&#8217;t set in stone). A system administrator will find use in <code>mksymlinks</code> and <code>genconf</code>, and a developer more in <code>mksymlinks</code> and <code>spawn</code>.</p>
<p>You&#8217;ll find extensive documentation on the <a href="http://github.com/laurentb/symfttpd">project page</a>; what will follow is a quick tutorial for developers.</p>
<p><!-- more --></p>
<p><strong>Install the necessary packages:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Debian/Ubuntu</span>
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-cgi php5-cli lighttpd
&nbsp;
<span style="color: #666666; font-style: italic;"># Gentoo</span>
emerge php <span style="color: #666666; font-style: italic;"># with USE=&quot;cli cgi&quot;</span>
emerge lighttpd <span style="color: #666666; font-style: italic;"># with USE=&quot;fastcgi&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Macports</span>
port <span style="color: #c20cb9; font-weight: bold;">install</span> php5 +fastcgi <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> lighttpd
&nbsp;
<span style="color: #666666; font-style: italic;"># Windows</span>
Nice try.</pre></div></div>

<p><strong>Get the symfttpd source code:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">git</span> clone <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>laurentb<span style="color: #000000; font-weight: bold;">/</span>symfttpd.git</pre></div></div>

<p>There are also archives you can download <a href="http://github.com/laurentb/symfttpd/downloads">here</a> if you want to avoid <em>git</em> or bleeding-edge changes.</p>
<p><strong>Basic configuration:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># notice the dot before symfttpd.conf.php</span>
<span style="color: #007800;">$EDITOR</span> ~<span style="color: #000000; font-weight: bold;">/</span>.symfttpd.conf.php</pre></div></div>

<p>Enter something like that:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sf_path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'1.0'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/home/myuser/symfony/1.0'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sf_path'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'1.4'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/home/myuser/symfony/1.4'</span><span style="color: #339933;">;</span></pre></div></div>

<p>Of course, you have to have to adapt it to the Symfony versions you have installed and where you put them.</p>
<p><strong>Configure the project:</strong><br />
If the project is using Symfony 1.4 in the <code>lib/vendor/symfony</code>, you don&#8217;t need to do anything. In case it is different, or to be on the safe side, create the file 	<code>config/symfttpd.conf.php</code> in your project. After, add the file to your project&#8217;s version control repository. If you&#8217;re lucky, someone already did it for you.</p>
</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>myproject
<span style="color: #666666; font-style: italic;"># this time, no dot</span>
<span style="color: #007800;">$EDITOR</span> config<span style="color: #000000; font-weight: bold;">/</span>symfttpd.conf.php</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'want'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1.3'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// The version of Symfony used by your project</span>
<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'lib_symlink'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'lib/vendor/symfony'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// lib/vendor/symfony will lead to the &quot;lib&quot; directory of Symfony</span></pre></div></div>

</pre>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>symfttpd<span style="color: #000000; font-weight: bold;">/</span>mksymlinks</pre></div></div>

<p>You're done.<br />
It will <strong>create symbolic links for plugins</strong> too, even if the version of Symfony (1.0 for instance) doesn't handle them!</p>
<p>To start the server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">~<span style="color: #000000; font-weight: bold;">/</span>symfttpd<span style="color: #000000; font-weight: bold;">/</span>spawn</pre></div></div>

<p>It will then tell you how to access it. It's time to stop fighting with old, unpredictable software like Apache and start developing again!</p>
<p><strong>What's coming in future releases:</strong></p>
<ul>
<li>Colors</li>
<li>Interactive configuration</li>
<li>Server/PHP logs displayed in the terminal</li>
<li>Handling "sample" files</li>
<li>Custom configuration support on various places</li>
</ul>
<p>Contributors are welcome.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2010/05/reducing-the-gap-between-symfony-and-non-php-frameworks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Symfony and lighttpd</title>
		<link>http://laurent.bachelier.name/2009/04/symfony-and-lighttpd/</link>
		<comments>http://laurent.bachelier.name/2009/04/symfony-and-lighttpd/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 19:29:24 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=92</guid>
		<description><![CDATA[Update: I have written a tool than can generate automatically the proper configuration and much more! I&#8217;ve seen some articles on how to configure lighttpd to serve a Symfony project, however they usually did at least one mistake: Assuming that requests with periods (&#8216;.&#8216;) are for static files (the period is a default separator in [...]]]></description>
			<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:87cb62125a7e275147cf0edddf7bc9d4b5ce9e0d'><p><em><strong>Update: I have written a <a href="http://laurent.bachelier.name/2010/05/reducing-the-gap-between-symfony-and-non-php-frameworks/">tool</a> than can generate automatically the proper configuration and much more!</strong></em></p>
<p>I&#8217;ve seen some articles on how to configure lighttpd to serve a Symfony project, however they usually did at least one mistake:</p>
<ul>
<li>Assuming that requests with periods (&#8216;<code>.</code>&#8216;) are for static files (the period is a default separator in Symfony, and is extensively used in the new admin generators).</li>
<li>Ignoring parameters after a &#8216;<code>?</code>&#8216; (they are not widely used, except&#8230; in the new admin generators, and can be very useful if your application)</li>
</ul>
<p>For the first part, there is a much simpler solution to handle static files: most of them are in specific directories, except for a very limited number of ones.</p>
<p>My solution also handles assets published by plugins (you might want to edit the corresponding line to a more liberal one though).</p>
<p>You might want to add your <code>sitemap.xml.gz</code> or <code>robots.txt</code> to this list if you generate them statically.</p>
<p>For the second part, you simply have to match explicitly the &#8216;<code>?</code>&#8216; part.</p>
<p>Here is the magic:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">alias.url <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">&quot;/sf/&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;/home/web/symfony_12/data/web/sf/&quot;</span>
<span style="color: #66cc66;">&#41;</span>
&nbsp;
url.rewrite-once <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">&quot;^/css/.+&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>, # directories with static files
  <span style="color: #ff0000;">&quot;^/js/.+&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,
  <span style="color: #ff0000;">&quot;^/images/.+&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,
  <span style="color: #ff0000;">&quot;^/uploads/.+&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>,
  <span style="color: #ff0000;">&quot;^/favicon<span style="color: #000099; font-weight: bold;">\.</span>ico$&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>, # static file example
  <span style="color: #ff0000;">&quot;^/sf[A-z]+Plugin.*&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>, # plugins
  <span style="color: #ff0000;">&quot;^/sf/.+&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;$0&quot;</span>, # symfony assets
  <span style="color: #ff0000;">&quot;^/backend<span style="color: #000099; font-weight: bold;">\.</span>php(/[^<span style="color: #000099; font-weight: bold;">\?</span>]*)(<span style="color: #000099; font-weight: bold;">\?</span>.*)?&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;/backend.php$1$2&quot;</span>, # allow access to another application
  <span style="color: #ff0000;">&quot;^(/[^<span style="color: #000099; font-weight: bold;">\?</span>]*)(<span style="color: #000099; font-weight: bold;">\?</span>.*)?&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;/index.php$1$2&quot;</span> # default application
<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>I guess the usage of periods in the rules also had the benefit of allowing the access to any alternative application automatically. With my solution you have to add each <code>appname.php</code> file manually, unless you use:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">  <span style="color: #ff0000;">&quot;^/([a-z]+)<span style="color: #000099; font-weight: bold;">\.</span>php(/[^<span style="color: #000099; font-weight: bold;">\?</span>]*)(<span style="color: #000099; font-weight: bold;">\?</span>.*)?&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;/$1.php$2$3&quot;</span>, # any app <span style="color: #66cc66;">&#40;</span>prod<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Or for allowing any environment:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">  <span style="color: #ff0000;">&quot;^/([a-z_]+)<span style="color: #000099; font-weight: bold;">\.</span>php(/[^<span style="color: #000099; font-weight: bold;">\?</span>]*)(<span style="color: #000099; font-weight: bold;">\?</span>.*)?&quot;</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">&quot;/$1.php$2$3&quot;</span>, # any app <span style="color: #66cc66;">&#40;</span>any env<span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>Note: your application must contain only lowercase letters, but you&#8217;re free to adapt it to your own usage.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2009/04/symfony-and-lighttpd/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Switching from BIND to PowerDNS in a few seconds</title>
		<link>http://laurent.bachelier.name/2009/03/switching-from-bind-to-powerdns-in-a-few-seconds/</link>
		<comments>http://laurent.bachelier.name/2009/03/switching-from-bind-to-powerdns-in-a-few-seconds/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 19:39:36 +0000</pubDate>
		<dc:creator>Laurent</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[config]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pdns]]></category>
		<category><![CDATA[powerdns]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[zone]]></category>

		<guid isPermaLink="false">http://laurent.bachelier.name/?p=62</guid>
		<description><![CDATA[Seconds, really. First, why stop using BIND? For me it just happened because I couldn&#8217;t understand why BIND wasn&#8217;t working (again). However there are many other reasons to make the switch before it&#8217;s too late. BIND has a bad security history, PowerDNS&#8216;s code is more &#8220;modern&#8221; and its various parts are well-separated (for example, you [...]]]></description>
			<content:encoded><![CDATA[<div class='microid-mailto+http:sha1:de057f5c4b013e7a98c9e03132cf8e469a9ee2b1'><p>Seconds, really.</p>
<p>First, why stop using <a href="http://en.wikipedia.org/wiki/BIND">BIND</a>? For me it just happened because I couldn&#8217;t understand why BIND wasn&#8217;t working (again). However there are many other reasons to make the switch before it&#8217;s too late. BIND has a bad security history, <a href="http://en.wikipedia.org/wiki/PowerDNS">PowerDNS</a>&#8216;s code is more &#8220;modern&#8221; and its various parts are well-separated (for example, you are not obligated to even <em>install</em> the recursor, it&#8217;s another daemon).</p>
<p>PowerDNS now has a <a href="http://doc.powerdns.com/bindbackend.html">BIND zone backend</a>, and it works with both primary (master) and secondary (slave) zones. Before that, only database or other fancy backends were available; for hosting only some small domains it would be overkill and a pain to manage.<br />
However the documentation wasn&#8217;t really clear. Here is how to do it.</p>
<p><span id="more-62"></span></p>
<h1>How to do it</h1>
<p>You should have this in your <code>pdns.conf</code> file:</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Start the bind backend (you can load multiple backends)</span>
launch=bind
<span style="color: #808080; font-style: italic;"># Path to your BIND named.conf</span>
bind-config=/etc/bind/named.conf
<span style="color: #808080; font-style: italic;"># PowerDNS will check if the zones are modified automatically. No need to reload the daemon!</span>
bind-check-interval=<span style="color: #ff4500;">300</span></pre></div></div>

<p>And&#8230; that&#8217;s it, you&#8217;re done.</p>
<p>But don&#8217;t forget to set <code>allow-axfr-ips</code> with the IPs of the secondary DNS servers of your primary domains in <code>pdns.conf</code> (that&#8217;s <code>allow-transfer</code> in <code>named.conf</code>).</p>
<h1>More details</h1>
<p>The only thing needed in <code>named.conf</code> are <code>zone</code> entries, anything else is ignored. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;">zone <span style="color: #483d8b;">&quot;example.com&quot;</span> IN <span style="color: black;">&#123;</span>
    type slave<span style="color: #66cc66;">;</span>
    <span style="color: #008000;">file</span> <span style="color: #483d8b;">&quot;/etc/bind/sec/example.com.zone&quot;</span><span style="color: #66cc66;">;</span>
    masters <span style="color: black;">&#123;</span> 1.3.3.7<span style="color: #66cc66;">;</span> <span style="color: black;">&#125;</span><span style="color: #66cc66;">;</span>
<span style="color: black;">&#125;</span><span style="color: #66cc66;">;</span>
&nbsp;
zone <span style="color: #483d8b;">&quot;example.net&quot;</span> IN <span style="color: black;">&#123;</span>
    type master<span style="color: #66cc66;">;</span>
    <span style="color: #008000;">file</span> <span style="color: #483d8b;">&quot;/etc/bind/pri/example.net.zone&quot;</span><span style="color: #66cc66;">;</span>
<span style="color: black;">&#125;</span><span style="color: #66cc66;">;</span></pre></div></div>

<p>If you want to create your first zone file, you can use the <a href="http://pgl.yoyo.org/adservers/bind-zone-file-creator.php">BIND zone file creator</a>.</p>
<p>I also encourage you to try out the <code>pdns_control</code>  tool that is bundled with PowerDNS.</p>
</div>]]></content:encoded>
			<wfw:commentRss>http://laurent.bachelier.name/2009/03/switching-from-bind-to-powerdns-in-a-few-seconds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

