<?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>GerillaFilm</title>
	<atom:link href="http://www.gerillafilm.se/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gerillafilm.se</link>
	<description>Small means, great stuff</description>
	<lastBuildDate>Tue, 06 Mar 2012 15:16:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>WordPress and jQuery Masonry setup with floating images</title>
		<link>http://www.gerillafilm.se/web/wordpress-and-jquery-masonry-setup-with-floating-images/</link>
		<comments>http://www.gerillafilm.se/web/wordpress-and-jquery-masonry-setup-with-floating-images/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 08:34:51 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[masonry]]></category>
		<category><![CDATA[the_post_thumbnail]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=347</guid>
		<description><![CDATA[The Masonry jQuery plugin is an easy way to stack divs in a nice grid without the usual problem with CSS floats &#8211; e.g divs with different heights will not look good beside each other. In a recent project a client wanted WordPress thumbnails stacked in this way. I first added some code to functions.php in order [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://masonry.desandro.com/" target="_blank">Masonry jQuery plugin</a> is an easy way to stack divs in a nice grid without the usual problem with CSS floats &#8211; e.g divs with different heights will not look good beside each other.</p>
<p>In a recent project a client wanted WordPress thumbnails stacked in this way. I first added some code to <em>functions.php</em> in order to set widths and heights to the selected thumbnails.<span id="more-347"></span></p>
<pre class="brush: php; title: ; notranslate"> // this goes into functions.php
add_image_size( 'front-thumb', 150, 9999 ); //150 pixels wide (and unlimited height)</pre>
<p>UPDATE 20 DEC 2011:</p>
<pre class="brush: php; title: ; notranslate">
// this goes on top of the page, either to header.php or on top of the specific page template

&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.masonry.min.js&quot;&gt;&lt;/script&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(document).ready(function($){

  var $container = $('.front-box-container');
  $container.imagesLoaded( function(){
    $container.masonry({
      itemSelector : '.front-box',
      singleMode:true
    });
  });

});
&lt;/script&gt;

// On the specific page or category archive create a new loop and create the markup for Masonry to catch:

&lt;?php query_posts(array('paged' =&gt; get_query_var('page'),'posts_per_page' =&gt; 25, 'cat'=&gt; '-3' ) ); ?&gt;

&lt;div class=&quot;front-box-container&quot;&gt;
&lt;ul class=&quot;front&quot;&gt;
&lt;?php while ( have_posts() ) : the_post(); ?&gt;

&lt;div class=&quot;front-box&quot;&gt;
    &lt;li&lt;?php if (! has_post_thumbnail()){echo (' class=&quot;front-noimage&quot;');}?&gt;&gt;
    	&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&gt;

    	   	&lt;?php the_post_thumbnail('front-thumb'); ?&gt;
    	        &lt;div class=&quot;front-info&quot;&gt;
            &lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
            &lt;div class=&quot;alternate-content&quot;&gt;&lt;?php the_excerpt(); ?&gt;&lt;/div&gt;
        &lt;/div&gt;
    &lt;/li&gt;

&lt;/div&gt;

&lt;?php endwhile;
wp_reset_query(); ?&gt;

&lt;/ul&gt;
&lt;/div&gt; &lt;!-- front-box-container --&gt;
</pre>
<p>That should make the images with (<em>.front-box</em>) inside the parent div (<em>.front-box-container</em>) float nicely with Masonry. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/web/wordpress-and-jquery-masonry-setup-with-floating-images/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ultimate .htaccess rewrite tutorial with 301 redirects</title>
		<link>http://www.gerillafilm.se/web/ultimate-htaccess-rewrite-tutorial-with-301-redirects/</link>
		<comments>http://www.gerillafilm.se/web/ultimate-htaccess-rewrite-tutorial-with-301-redirects/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 08:28:44 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[clean urls]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[new domain]]></category>
		<category><![CDATA[parameter]]></category>
		<category><![CDATA[query string]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[retain path]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=286</guid>
		<description><![CDATA[So, over the last couple of weeks I have moved several sites to new locations and publishing platforms which demands some redirects unless you wanna be a SEO killer. The examples below are mostly URLs with query strings which I either want to hide or make prettier. The fourth and fifth examples are quite useful when [...]]]></description>
			<content:encoded><![CDATA[<p>So, over the last couple of weeks I have moved several sites to new locations and publishing platforms which demands some redirects unless you wanna be a SEO killer. The examples below are mostly URLs with query strings which I either want to hide or make prettier. The fourth and fifth examples are quite useful when you want to create human readable URLs for APIs or web services.</p>
<p><em>Updated 22 November 2011.</em></p>

<h2>1. Rewrite and redirect URLs with query parameters (files placed in root directory)</h2>
<p>Original URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/index.php?id=1</pre>
<p>Desired destination URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/path-to-new-location/</pre>
<p>.htaccess syntax:</p>
<pre class="brush: xml; title: ; notranslate">RewriteEngine on
RewriteCond %{QUERY_STRING} id=1
RewriteRule ^index\.php$ /path-to-new-location/? [L,R=301]</pre>
<h2>2. Redirect URLs with query parameters (files placed in subdirectory)</h2>
<p>Original URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/sub-dir/index.php?id=1</pre>
<p>Desired destination URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/path-to-new-location/</pre>
<p>.htaccess syntax:</p>
<pre class="brush: xml; title: ; notranslate">RewriteEngine on
RewriteCond %{QUERY_STRING} id=1
RewriteRule ^sub-dir/index\.php$ /path-to-new-location/? [L,R=301]</pre>
<h2>3. Redirect one clean URL to a new clean URL</h2>
<p>Original URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/old-page/</pre>
<p>Desired destination URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/new-page/</pre>
<p>.htaccess syntax:</p>
<pre class="brush: xml; title: ; notranslate">RewriteEngine On
RewriteRule ^old-page/?$ $1/new-page$2 [R=301,L]</pre>
<h2>4. Rewrite and redirect URLs with query parameter to directory based structure, retaining query string in URL root level</h2>
<p>Original URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/index.php?id=100</pre>
<p>Desired destination URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/100/</pre>
<p>.htaccess syntax:</p>
<pre class="brush: xml; title: ; notranslate">RewriteEngine On
RewriteRule ^([^/d]+)/?$ index.php?id=$1 [QSA]</pre>
<h2>5. Rewrite URLs with query parameter to directory based structure, retaining query string parameter in URL subdirectory</h2>
<p>Original URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/index.php?category=fish</pre>
<p>Desired destination URL:</p>
<pre class="brush: xml; title: ; notranslate">http://www.example.com/category/fish/</pre>
<p>.htaccess syntax:</p>
<pre class="brush: xml; title: ; notranslate">RewriteEngine On
RewriteRule ^/?category/([^/d]+)/?$ index.php?category=$1 [L,QSA]</pre>
<h2>6. Domain change &#8211; redirect all incoming request from old to new domain (retain path)</h2>
<pre class="brush: xml; title: ; notranslate">RewriteEngine on
RewriteCond %{HTTP_HOST} ^example-old\.com$ [NC]
RewriteRule ^(.*)$ http://www.example-new.com/$1 [R=301,L]</pre>
<p>If you do not want to pass the path in the request to the new domain, change the last row to:</p>
<pre class="brush: xml; title: ; notranslate">RewriteRule ^(.*)$ http://www.example-new.com/ [R=301,L]</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/web/ultimate-htaccess-rewrite-tutorial-with-301-redirects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Shell script: create virtual hosts with PHP/fastCGI (mod_fcgi)</title>
		<link>http://www.gerillafilm.se/linux/shell-script-create-virtual-hosts-with-phpfastcgi-mod_fcgi/</link>
		<comments>http://www.gerillafilm.se/linux/shell-script-create-virtual-hosts-with-phpfastcgi-mod_fcgi/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 23:35:54 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fcgid]]></category>
		<category><![CDATA[FcgidMaxRequestLen]]></category>
		<category><![CDATA[groupadd]]></category>
		<category><![CDATA[http error]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[useradd]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=172</guid>
		<description><![CDATA[UPDATES: Version 1.1 &#8211; June 20 2011 Added  &#8221;FcgidMaxRequestLen 1000000000&#8221; to virtual host settings in order to get the WordPress Flash based image uploader to work. The default value in fcgid caused it to throw a &#8220;HTTP Error&#8221; when crunching the images. Commented out the Apache directive &#8220;ServerAlias&#8221; which in previous version defaulted to *.example.com. [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: 15px; font-weight: bold;">UPDATES:</span></p>
<h4>Version 1.1 &#8211; June 20 2011</h4>
<ul>
<li>Added  &#8221;<em>FcgidMaxRequestLen 1000000000</em>&#8221; to virtual host settings in order to get the WordPress Flash based image uploader to work. The default value in fcgid caused it to throw a &#8220;HTTP Error&#8221; when crunching the images.</li>
<li>Commented out the Apache directive &#8220;ServerAlias&#8221; which in previous version defaulted to <em>*.example.com</em>. That of course might cause problems when setting up both root domain and sub domains on the same server. Feel free to uncomment or add custom aliases.</li>
<li>Moved the ports.conf tip from script echo to comments at the end.</li>
</ul>

<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
# Shell script to create virtual hosts running PHP/FastCGI with mod_fcgi
# on Apache 2
# -------------------------------------------------------------------------
# Version 1.1 (June 20 2011)
# -------------------------------------------------------------------------
# Copyright (c) 2011 Finn Hensner &lt;http://www.gerillafilm.se&gt;
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------

clear
echo &quot;# -----------------------------------------------------------&quot;
echo &quot;# ---------- Virtual host with mod_fcgi - installer ---------&quot;
echo &quot;# -----------------------------------------------------------&quot;

read -p &quot;Enter domain name to use: &quot; domainName

read -p &quot;Enter port number for virtual host: &quot; port

if [ $(id -u) -eq 0 ]; then
    read -p &quot;Enter username : &quot; userName
    read -s -p &quot;Enter password : &quot; userPassword
    egrep &quot;^$userName&quot; /etc/passwd &gt;/dev/null
    if [ $? -eq 0 ]; then
        echo &quot;$userName exists!&quot;
        exit 1
    else
        pass=$(perl -e 'print crypt($ARGV[0], &quot;password&quot;)' $userPassword)
                groupadd $userName;
                useradd -s /bin/sh -p $pass -d /var/www/$domainName -m -g $userName $userName

        [ $? -eq 0 ] &amp;&amp; echo &quot;User has been added to system!&quot; || echo &quot;Failed to add a user!&quot;
    fi
else
    echo &quot;Only root may add a user to the system&quot;
    exit 2
fi

clear
echo -e &quot;\n\tDomain name: $domainName:$port&quot;
echo -e &quot;\tUser name: $userName&quot;
echo -e &quot;\tPassword: $userPassword&quot;
echo &quot;(Your user credentials will be saved in a .txt-file outside your web root)&quot;
echo -e &quot;\tFinish with these settings?\n\n&quot;
select yn in &quot;Yes&quot; &quot;No&quot;; do
    case $yn in
        Yes ) echo &quot;Preparing...&quot;;

#sleep 1
#groupadd $userName;
echo &quot;Added group $groupName&quot;

#sleep 1
#useradd -s /bin/sh -p $userPassword -d /var/www/$domainName -m -g $userName $userName
#echo &quot;Added user $userName&quot;

sleep 1
mkdir -p /var/www/$domainName/public_html
echo &quot;Creating folder /var/www/$domainName/public_html&quot;

sleep 2
chown -R $userName:$userName /var/www/$domainName
echo &quot;Added ownership to webroot&quot;

sleep 2
mkdir -p /var/www/php-fcgi-scripts/$domainName
echo &quot;Created cgi script folder for $domainName&quot;

sleep 1
echo -e &quot;#!/bin/sh\nPHPRC=/etc/php5/cgi/\nexport PHPRC\nexport PHP_FCGI_MAX_REQUESTS=5000\nexport PHP_FCGI_CHILDREN=8\nexec /usr/lib/cgi-bin/php&quot; &gt; /var/www/php-fcgi-scripts/$domainName/php-fcgi-starter
echo &quot;Created cgi-wrapper for $domainName&quot;

sleep 1
chmod 755 /var/www/php-fcgi-scripts/$domainName/php-fcgi-starter
chown -R $userName:$userName /var/www/php-fcgi-scripts/$domainName
echo &quot;Changed ownership on fcgi-wrapper&quot;

sleep 1
echo -e &quot;&lt;VirtualHost *:$port&gt;\n\tServerName $domainName\n\t#ServerAlias $domainName *.$domainName\n\tServerAdmin webmaster@$domainName\n\tDocumentRoot /var/www/$domainName/public_html\n\n\n\t&lt;IfModule mod_fcgid.c&gt;\n\t\tSuexecUserGroup $userName $userName\n\t\tFcgidMaxRequestLen 1000000000\n\t\t&lt;Directory /var/www/$domainName/public_html&gt;\n\t\t\tOptions +ExecCGI\n\t\t\tAllowOverride All\n\t\t\tAddHandler fcgid-script .php\n\t\t\tFCGIWrapper /var/www/php-fcgi-scripts/$domainName/php-fcgi-starter .php\n\t\t\tOrder allow,deny\n\t\t\tAllow from all\n\t\t&lt;/Directory&gt;\n\t&lt;/IfModule&gt;\n\n\nServerSignature Off\n\n\n&lt;/VirtualHost&gt;&quot; &gt; /etc/apache2/sites-available/$domainName
echo &quot;Added virtual host for $domainName&quot;

sleep 1
a2ensite $domainName
echo &quot;Enabling virtual host $domainName&quot;

sleep 1
/etc/init.d/apache2 reload
echo &quot;Restarting apache&quot;

sleep 1
echo -e &quot;Your account credentials:\n\nDomain name: $domainName:$port\nUser name: $userName\nPassword: $userPassword&quot; &gt; /var/www/$domainName/login-$domainName.txt
echo -e &quot;******************************************************************************&quot;
echo -e &quot;Your account credentials:\n\nDomain name: $domainName:$port\nUser name: $userName\nPassword: $userPassword&quot;
echo -e &quot;Saved text file with credentials in /var/www/$domainName/login-$domainName.txt&quot;
echo -e &quot;******************************************************************************\n\n&quot;
chown $userName:$userName /var/www/$domainName/login-$domainName.txt
chmod 600 /var/www/$domainName/login-$domainName.txt

break;;
        No ) exit;;
    esac
done

# -------------------------------------------------------------------------
# Make sure you edit /etc/apache2/ports.conf and add another NameVirtualHost
# if you want your server to listen to additional ports, ie 8080 for proxying.
# -------------------------------------------------------------------------
</pre>
<p><span style="font-size: 15px; line-height: 19px; white-space: normal;"><br />
</span></p>
<pre><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 15px; font-weight: bold; line-height: 19px; white-space: normal;">Instructions</span></pre>
<p>To run the script, begin with pasting it into a new file:</p>
<pre class="brush: bash; title: ; notranslate">nano vhost-fcgi.sh</pre>
<p>Make it executable:</p>
<pre class="brush: bash; title: ; notranslate">chmod 755 vhost-fcgi.sh</pre>
<p>Run it:</p>
<pre class="brush: bash; title: ; notranslate">./vhost-fcgi.sh</pre>
<p>To easily install Apache 2 and dependencies, read <a title="Shell script: install Apache 2 with dependencies for PHP/mod_fcgi" href="http://www.gerillafilm.se/linux/shell-script-install-apache-2-with-dependencies-for-phpmod_fcgi/">Shell script: install Apache 2 with dependencies for PHP/mod_fcgi</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/linux/shell-script-create-virtual-hosts-with-phpfastcgi-mod_fcgi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shell script &#8211; install LAMP with dependencies for PHP/mod_fcgi</title>
		<link>http://www.gerillafilm.se/linux/shell-script-install-apache-2-with-dependencies-for-phpmod_fcgi/</link>
		<comments>http://www.gerillafilm.se/linux/shell-script-install-apache-2-with-dependencies-for-phpmod_fcgi/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 22:44:37 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[fresh]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mod_fcgid]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[stack]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=179</guid>
		<description><![CDATA[This script is intended for fresh Linux installs to provide support for the LAMP stack running with mod_fcgid instead of the default mod_php Apache module. UPDATES: Version 1.1 &#8211; August 18 2011 Added apt-get update to refresh package list Added MySQL server Added php5-gd library (to comply with Drupal 7 requirements) Added PDO MySQL driver [...]]]></description>
			<content:encoded><![CDATA[<p>This script is intended for fresh Linux installs to provide support for the LAMP stack running with mod_fcgid instead of the default mod_php Apache module.</p>
<p><strong>UPDATES:</strong></p>
<h4>Version 1.1 &#8211; August 18 2011</h4>
<ul>
<li>Added apt-get update to refresh package list</li>
<li>Added MySQL server</li>
<li>Added php5-gd library (to comply with Drupal 7 requirements)</li>
<li>Added PDO MySQL driver (to comply with Drupal 7 requirements)</li>
<li>Moved specific php.ini extensions and fixes to separate custom.ini file</li>
<li>Added restart of proftpd<span id="more-179"></span></li>
</ul>
<p>To run the script, begin with pasting it into a new file:</p>
<pre class="brush: bash; title: ; notranslate">nano webinstall.sh</pre>
<p>Make it executable:</p>
<pre class="brush: bash; title: ; notranslate">chmod 755 webinstall.sh</pre>
<p>Run it:</p>
<pre class="brush: bash; title: ; notranslate">./webinstall.sh</pre>
<p>To easily set up sites and users, read <a title="Shell script: create virtual hosts with PHP/fastCGI (mod_fcgi)" href="http://www.gerillafilm.se/linux/shell-script-create-virtual-hosts-with-phpfastcgi-mod_fcgi/">Shell script: create virtual hosts with PHP/fastCGI (mod_fcgi)</a></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash
# Shell script to install LAMP with dependencies for running PHP applications
# with mod_fcgi
# -------------------------------------------------------------------------
# Version 1.1 (August 18 2011)
# -------------------------------------------------------------------------
# Copyright (c) 2011 Finn Hensner &lt;http://www.gerillafilm.se&gt;
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
apt-get update
aptitude install apache2 apache2-suexec libapache2-mod-fcgid php5-cgi
a2dismod php5
a2enmod rewrite
a2enmod suexec
a2enmod include
a2enmod fcgid

apt-get install mysql-server
apt-get install php5-gd
apt-get install php5-common php5-mysql

sleep 1
echo &quot;Adding extensions and fixes to custom ini&quot;
cat &gt; /etc/php5/conf.d/custom.ini &lt;&lt; EOF
cgi.fix_pathinfo = 1
extension=gd2.so
extension=pdo.so
extension=pdo_mysql.so
extension=php_pgsql.so
extension=php_pdo_pgsql.so
EOF

sleep 1
echo &quot;Add server name to Apache config&quot;
echo &quot;ServerName 127.0.0.1&quot; &gt;&gt; /etc/apache2/apache2.conf

sleep 1
echo &quot;Installing ProFTPd server&quot;
apt-get purge proftpd
apt-get install proftpd
#jail users in their home directory
echo -e &quot;&lt;Global&gt;\nDefaultRoot ~\n&lt;/Global&gt;&quot; &gt;&gt; /etc/proftpd/proftpd.conf

sleep 1
echo &quot;Removing default virtual host.&quot;
rm /etc/apache2/sites-available/default
rm /etc/apache2/sites-enabled/default-000

sleep 1
echo &quot;Restarting apache2 and proftpd&quot;
service apache2 restart
service proftpd restart
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/linux/shell-script-install-apache-2-with-dependencies-for-phpmod_fcgi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom WordPress Varnish VCL v1</title>
		<link>http://www.gerillafilm.se/web/custom-wordpress-varnish-vcl-v1/</link>
		<comments>http://www.gerillafilm.se/web/custom-wordpress-varnish-vcl-v1/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 08:56:44 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[varnish]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=158</guid>
		<description><![CDATA[Over the last couple of days I&#8217;ve been struggling with getting my dev WordPress environment set up with Varnish (2.1.3) Out of the box with minimal config it provides great speed and hitrate but zero functionality together with the cookie-laden WordPress. So far I have tested a bunch of VCL:s found online but here&#8217;s my take [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last couple of days I&#8217;ve been struggling with getting my dev WordPress environment set up with <a href="http://www.varnish-cache.org" target="_blank">Varnish</a> (2.1.3) Out of the box with minimal config it provides great speed and hitrate but zero functionality together with the cookie-laden WordPress. So far I have tested a bunch of VCL:s found online but here&#8217;s my take (based on practically every nice example found out there).<span id="more-158"></span></p>
<p>To get WordPress to purge when you create or edit posts, I have tried W3 Total Cache, but the Varnish implementation doesn&#8217;t seem to work that well. The only plug-in that I have gotten to work with this setup is <a href="http://github.com/pkhamre/wp-varnish" target="_blank">WP-Varnish</a> by Pål-Kristian Hamre.</p>
<p>The single specified backend config has to do with another test I&#8217;m working on with getting Varnish to serve different sites running for example Drupal and WordPress, with a single VCL. I&#8217;ll get back to that one.</p>
<pre class="brush: python; title: ; notranslate">backend wp1 {.host = &quot;mywpsite.mydomain.com&quot;;.port = &quot;8080&quot;;}
sub vcl_recv {
if (req.http.host == &quot;mywpsite.mydomain.com&quot;) {set req.http.host = &quot;mywpsite.mydomain.com&quot;;set req.backend = wp1;}
}
acl purge {
&quot;127.0.0.1&quot;;
}
sub vcl_recv {
 set req.grace = 6h;
 if (req.request == &quot;PURGE&quot;) {
if (!client.ip ~ purge) {error 405 &quot;Not allowed.&quot;;}purge(&quot;req.url ~ &quot; req.url &quot; &amp;&amp; req.http.host == &quot; req.http.host);error 200 &quot;Purged.&quot;;
}
}
# Do the PURGE thing
sub vcl_hit {if (req.request == &quot;PURGE&quot;) {set obj.ttl = 0s;error 200 &quot;Purged&quot;;}}
sub vcl_miss {if (req.request == &quot;PURGE&quot;) {error 404 &quot;Not in cache&quot;;}}
sub vcl_recv {
 # set standard proxied ip header for getting original remote address
set req.http.X-Forwarded-For = client.ip;
 # logged in users must always pass
if( req.url ~ &quot;^/wp-(login|admin)&quot; || req.http.Cookie ~ &quot;wordpress_logged_in_&quot; ){return (pass);}
 # don't cache search results
if( req.url ~ &quot;\?s=&quot; ){return (pass);}
 # always pass through posted requests and those with basic auth
if ( req.request == &quot;POST&quot; || req.http.Authorization ) {return (pass);}
 # else ok to fetch a cached page
unset req.http.Cookie;
return (lookup);
}
sub vcl_fetch {
 # remove some headers we never want to see
unset beresp.http.Server;
unset beresp.http.X-Powered-By;
 # only allow cookies to be set if we're in admin area - i.e. commenters stay logged out
if( beresp.http.Set-Cookie &amp;&amp; req.url !~ &quot;^/wp-(login|admin)&quot; ){unset beresp.http.Set-Cookie;}
 # don't cache response to posted requests or those with basic auth
if ( req.request == &quot;POST&quot; || req.http.Authorization ) {return (pass);}
 # Trust Varnish if it says this is not cacheable
if ( ! beresp.cacheable ) {return (pass);}
 # only cache status ok
if ( beresp.status != 200 ) {return (pass);}
 # don't cache search results
if( req.url ~ &quot;\?s=&quot; ){return (pass);}
 # else ok to cache the response
set beresp.ttl = 24h;
return (deliver);
}
sub vcl_deliver {
# add debugging headers, so we can see what's cached
if (obj.hits &gt; 0) {set resp.http.X-Cache = &quot;HIT&quot;;set resp.http.X-Cache-Hits = obj.hits;}
else {set resp.http.X-Cache = &quot;MISS&quot;;}
# remove some headers added by varnish
unset resp.http.Via;
unset resp.http.X-Varnish;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/web/custom-wordpress-varnish-vcl-v1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Webmin &#8211; Hetzner VPS Debian 6 LAMP + fastcgi + php5 + apache</title>
		<link>http://www.gerillafilm.se/linux/webmin-setup-hetzner-debian-6-lamp-stack-with-fastcgi-php5-apache/</link>
		<comments>http://www.gerillafilm.se/linux/webmin-setup-hetzner-debian-6-lamp-stack-with-fastcgi-php5-apache/#comments</comments>
		<pubDate>Wed, 18 May 2011 10:50:22 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[fcgid]]></category>
		<category><![CDATA[Hetzner]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vq7]]></category>
		<category><![CDATA[webmin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=138</guid>
		<description><![CDATA[This tutorial applies to servers preconfigured with LAMP (Debian 6, Apache 2, Mysql 5, PHP 5.2). If the LAMP stack is not installed, it&#8217;s pretty straightforward to install the respective components via apt-get install. Since the image I&#8217;m using has Webmin preinstalled I use it to quickly get started. The main thing with this setup [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial applies to servers preconfigured with LAMP (Debian 6, Apache 2, Mysql 5, PHP 5.2). If the LAMP stack is not installed, it&#8217;s pretty straightforward to install the respective components via apt-get install. Since the image I&#8217;m using has Webmin preinstalled I use it to quickly get started.<span id="more-138"></span></p>
<p>The main thing with this setup is to avoid permission issues when installing and running Drupal and WordPress. Since they depend quite heavily on writing files, changing settings, updating plugins and modules you may end up with a very loose permissions scheme that tends to lead to an insecure installation.</p>
<h3>Goals</h3>
<ul>
<li>make Apache run PHP applications as an arbitrary user (not www-data)</li>
<li>create &#8220;sandboxed&#8221; websites and users to avoid Apache user gaining access to other sites on the same machine (especially important if you&#8217;re using or want to create a shared hosting environment)</li>
<li>avoid 777 permissions all over the place</li>
</ul>
<p>(If Apache is already installed, this is where you begin)</p>
<p><strong>Install modules:</strong></p>
<pre>aptitude install apache2-suexec libapache2-mod-fcgid php5-cgi
/etc/init.d/apache2 restart</pre>
<p>You might get the following error message, ignore it for now:</p>
<pre>"Could not reliably determine the server's fully qualified domain name,
using xxx.xxx.xxx.xxx for ServerName"</pre>
<p><strong>Disable the mod_php </strong>- we will use fcgid instead:</p>
<pre>a2dismod php5</pre>
<p><strong>Enable the newly installed Apache modules:</strong></p>
<pre>a2enmod rewrite
a2enmod suexec
a2enmod include
a2enmod fcgid</pre>
<p><strong>Open and edit /etc/php5/cgi/php.ini</strong></p>
<pre>nano /etc/php5/cgi/php.ini</pre>
<p><strong>Uncomment or add the following line:</strong></p>
<pre>cgi.fix_pathinfo = 1</pre>
<p><strong>Restart Apache:</strong></p>
<pre>/etc/init.d/apache2 restart</pre>
<p><strong>In Webmin</strong>, go to Servers &gt; ProFTPD Server &gt; Files and directories</p>
<pre>Set "Limit users to directories" to "Home directory". Save.
Apply changes (restart ProFTPD Server).</pre>
<p><strong>Create a directory</strong> for the site which also will be the home directory for your web user:</p>
<pre>mkdir -p /var/www/my<em>newsite.com</em>/public_html</pre>
<p><strong>In Webmin</strong>, create a user under System &gt; Users and groups &gt; Create a new user</p>
<pre>Username: <em>mynewuser</em>
User ID: Automatic
Home directory: browse to /var/www/my<em>newsite.com</em>/ and select it
Password: Normal password &gt; (<em>Choose a good, random password</em>)
Primary group: New group with same name as user
Create home directory: Yes
Copy template files to home directory: Yes
Create user in other modules: Yes</pre>
<p><strong>Make your new user owner of their webroot:</strong></p>
<pre>cd /var/www/my<em>newsite.com </em>
chown -R <em>mynewuser:<em>mynewusergroup</em></em> *
<em>NOTE: sometimes the permissions might get corrupted, in that case, try: </em>chown -R <em>mynewuser:<em>mynewusergroup</em></em> /var/www/<em>mynewsite.com</em></pre>
<p><strong>Create a fastcgi wrapper script for the new site:</strong></p>
<pre>mkdir -p /var/www/php-fcgi/<em>mynewsite.com</em>
nano /var/www/php-fcgi/<em>mynewsite.com</em>/php-fcgi-starter</pre>
<p><strong>Add the following to php-fcgi-starter then save:</strong></p>
<pre><!-- p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} -->#!/bin/sh
PHPRC=/etc/php5/cgi/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
exec /usr/lib/cgi-bin/php</pre>
<p><strong>Make the script executable and owned by the user:</strong></p>
<pre>chmod 755 /var/www/php-fcgi/<em>mynewsite.com</em>/php-fcgi-starter

cd /var/www/php-fcgi/<em>mynewsite.com chown -R mynewuser:nynewusergroup *  </em></pre>
<p>In Webmin, remove the catch-all virtual server if it exists (Handles the name-based server <tt></tt>on address <tt>*</tt>.)</p>
<p><strong>Then remove the leftovers from the virtual host:</strong></p>
<pre>rm /etc/apache2/sites-enabled/000-default</pre>
<p><strong>Create a new virtual host:</strong></p>
<p>Servers &gt; Apache webserver &gt; Create virtual host:</p>
<pre>Specific address:  <em>mynewsite.com </em>Add name virtual server address (if needed): Yes
Listen on address (if needed): Yes
Port: 80
Document root: /var/www/<em>mynewsite.com</em>/public_html
Allow access to this directory: Yes
Server name: <em>mynewsite.com </em>Add virtual server to file: New file under virtual servers directory
Copy directives from: Nowhere</pre>
<p>NOTE 1: if you later create sites to be handled by fcgi you may copy/paste the directives from the initial site and then only change document root and user/group info in the new site&#8217;s directives.</p>
<p>NOTE 2:  you still need to create new fastcgi wrapper scripts and unique user for each site.</p>
<p><strong>Tell Apache to listen for the new site:</strong></p>
<pre>Servers &gt; Apache webserver &gt; Global configuration &gt; Networking and addresses:

Check "Include all addresses".
Under "Adresses for name virtual servers" add:
<em>mynewsite.com:80</em></pre>
<p><strong>Save and restart Apache </strong>(&#8220;Apply changes&#8221; in Webmin).</p>
<p><strong>Add directives for the site</strong>. Virtual server &gt; Edit directives:</p>
<pre>ServerName mynewsite.com
ServerAlias mynewsite.com
DocumentRoot /var/www/mynewsite.com/public_html
&lt;IfModule mod_fcgid.c&gt;
 SuexecUserGroup mynewuser mynewusergroup 
 &lt;Directory /var/www/mynewsite.com/public_html&gt;
  Options +ExecCGI
  AllowOverride All
  AddHandler fcgid-script .php
  FCGIWrapper /var/www/php-fcgi/mynewsite.com/php-fcgi-starter .php
  Order allow,deny
  Allow from all 
 &lt;/Directory&gt;&lt;/IfModule&gt;
# ErrorLog /var/log/apache2/error.log
# CustomLog /var/log/apache2/access.log combined
ServerSignature Off</pre>
<p><strong>Save and restart Apache. Done!</strong></p>
<p>(<a href="http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-debian-lenny" target="_blank">Based on Falko Timme&#8217;s guide</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/linux/webmin-setup-hetzner-debian-6-lamp-stack-with-fastcgi-php5-apache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Lyrics to John Ottman&#8217;s &quot;They&#8217;ll Remember You&quot; from Valkyrie</title>
		<link>http://www.gerillafilm.se/film/lyrics-to-theyll-remember-you-from-valkyria/</link>
		<comments>http://www.gerillafilm.se/film/lyrics-to-theyll-remember-you-from-valkyria/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 10:16:30 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Film]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Goethe]]></category>
		<category><![CDATA[John Ottman]]></category>
		<category><![CDATA[Lyrics]]></category>
		<category><![CDATA[Tom Cruise]]></category>
		<category><![CDATA[Valkyria]]></category>
		<category><![CDATA[Valkyrie]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/uncategorized/lyrics-to-theyll-remember-you-from-valkyria/</guid>
		<description><![CDATA[I&#8217;ve tried to find the lyrics and origins to the final piece of the soundtrack for Valkyria, composed by John Ottman. &#8220;They&#8217;ll remember you&#8221; is a stunningly beautiful modern choir piece with references to both Mozart and Monteverdi. According to Wikipedia, Ottman based the lyrics on a well known poem by german writer Johann Wolfgang [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve tried to find the lyrics and origins to the final piece of the soundtrack for Valkyria, composed by John Ottman. &#8220;They&#8217;ll remember you&#8221; is a stunningly beautiful modern choir piece with references to both Mozart and Monteverdi.<span id="more-123"></span></p>
<p>According to Wikipedia, Ottman based the lyrics on a well known poem by german writer Johann Wolfgang von Goethe &#8211; The Wanderer (Ein Gleiches, Wandrers Nachtlied, written in 1780).</p>
<p><iframe src="http://www.youtube.com/embed/tg0pDqMueu4" frameborder="0" width="425" height="27"></iframe></p>
<blockquote><p>Über allen Gipfeln<br />
Ist Ruh<br />
In allen Wipfeln<br />
Spürest du<br />
Kaum einen Hauch<br />
Die Vögelein schweigen<br />
Vögelein schweigen<br />
Schweigen im Walde<br />
Warte nur, balde<br />
Ruhest du auch</p>
<p>Über allen Gipfeln<br />
Ist Ruh<br />
In allen Wipfeln<br />
Spürest du<br />
Kaum einen Hauch<br />
Die Vögelein schweigen<br />
Schweigen im Walde<br />
Warte nur, balde<br />
Ruhest du<br />
Ruhest du auch</p></blockquote>
<p>Spotify link: <a href="http://open.spotify.com/track/2PppSYJrJ62LQvkglG0evG" target="_blank">http://open.spotify.com/track/2PppSYJrJ62LQvkglG0evG</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/film/lyrics-to-theyll-remember-you-from-valkyria/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automount a volume in Fedora</title>
		<link>http://www.gerillafilm.se/linux/automount-a-volume-in-fedora/</link>
		<comments>http://www.gerillafilm.se/linux/automount-a-volume-in-fedora/#comments</comments>
		<pubDate>Mon, 10 May 2010 19:45:56 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amahi]]></category>
		<category><![CDATA[automatically]]></category>
		<category><![CDATA[automount]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=113</guid>
		<description><![CDATA[To automatically mount a specified volume each time you boot into Fedora, edit the following file: Add the following line  at the end depending on volume and mount point: Save and exit. (If the volume is formatted with NTFS, use the following syntax instead)]]></description>
			<content:encoded><![CDATA[<p>To automatically mount a specified volume each time you boot into Fedora, edit the following file:</p>
<pre class="brush: bash; title: ; notranslate">/etc/fstab</pre>
<p>Add the following line  at the end depending on volume and mount point:</p>
<pre class="brush: bash; title: ; notranslate">/dev/sdb1 /var/hda/files/</pre>
<p>Save and exit.</p>
<p>(If the volume is formatted with NTFS, use the following syntax instead)</p>
<pre class="brush: bash; title: ; notranslate">/dev/sdb1 /var/hda/files/ ntfs-3g defaults 0 0</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/linux/automount-a-volume-in-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mount a drive or volume to use with Amahi home server</title>
		<link>http://www.gerillafilm.se/linux/mount-drive-to-use-with-amahi-home-server/</link>
		<comments>http://www.gerillafilm.se/linux/mount-drive-to-use-with-amahi-home-server/#comments</comments>
		<pubDate>Sun, 09 May 2010 22:42:54 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amahi]]></category>
		<category><![CDATA[drive]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[NTFS]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=106</guid>
		<description><![CDATA[How to mount a drive or volume to be accessible by Amahi home server: First you need to find out what the volume is called within Fedora. To list the drives recognized by the system type the following in terminal: Let&#8217;s say you want to mount the volume named &#8220;sdb1&#8243;, then use: If the volume [...]]]></description>
			<content:encoded><![CDATA[<p>How to mount a drive or volume to be accessible by Amahi home server:</p>
<p>First you need to find out what the volume is called within Fedora. To list the drives recognized by the system type the following in terminal:</p>
<pre class="brush: bash; title: ; notranslate">ls /dev/sd*</pre>
<p>Let&#8217;s say you want to mount the volume named &#8220;sdb1&#8243;, then use:</p>
<pre class="brush: bash; title: ; notranslate">mount /dev/sdb1 /var/hda/files/myvolume</pre>
<p>If the volume you want to mount is an NTFS drive, instead use:</p>
<pre class="brush: bash; title: ; notranslate">mount -t ntfs /dev/sdb1 /var/hda/files/myvolume</pre>
<p>Note that you may need to change priviligies on the mounted drive if you want to download directly from Amahi or copy to it over the network.</p>
<p>When you&#8217;ve mounted the volume in <em>/var/files/</em> you only need to specify the name you gave it to add it as a share in Amahi share settings.</p>
<p>If you want to mount the volume automatically when you boot, read <a href="http://www.gerillafilm.se/linux/automount-a-volume-in-fedora/">Automount a volume in Fedora</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/linux/mount-drive-to-use-with-amahi-home-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic login with Fedora 12</title>
		<link>http://www.gerillafilm.se/linux/automatic-login-to-fedora-12/</link>
		<comments>http://www.gerillafilm.se/linux/automatic-login-to-fedora-12/#comments</comments>
		<pubDate>Sat, 08 May 2010 12:02:58 +0000</pubDate>
		<dc:creator>Finn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amahi]]></category>
		<category><![CDATA[autologin]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[logon]]></category>

		<guid isPermaLink="false">http://www.gerillafilm.se/?p=89</guid>
		<description><![CDATA[Here&#8217;s how to automatically login to a Fedora Linux box. Useful when you run a headless machine as home server, in my case Amahi Home Server. Fire up terminal, locally or via SSH and log in as root. Edit the GDM config file by following file by typing: Add the following to the end of [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to automatically login to a Fedora Linux box. Useful when you run a headless machine as home server, in my case Amahi Home Server.</p>
<p>Fire up terminal, locally or via SSH and log in as root.</p>
<p>Edit the GDM config file by following file by typing:</p>
<pre class="brush: bash; title: ; notranslate">nano /etc/gdm/custom.conf</pre>
<p>Add the following to the end of the file:</p>
<pre class="brush: bash; title: ; notranslate">
[daemon]
 TimedLoginEnable=true
 AutomaticLoginEnable=true
 AutomaticLogin=yourusername
 TimedLogin=yourusername
 TimedLoginDelay=0
</pre>
<p>Save and exit. On reboot, the machine should autologin with the username you specified.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gerillafilm.se/linux/automatic-login-to-fedora-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.gerillafilm.se/feed/ ) in 1.28324 seconds, on May 20th, 2012 at 11:06 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 20th, 2012 at 4:30 pm UTC -->
