<?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>Linux System Admins Blog &#187; Tips and Tricks</title>
	<atom:link href="http://linuxsysadminblog.com/category/tips-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxsysadminblog.com</link>
	<description>System admins of Promet - an e-commerce, high availability Open Source web shop - share their findings</description>
	<lastBuildDate>Sat, 10 Jul 2010 01:33:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HowTo remove a list of files</title>
		<link>http://linuxsysadminblog.com/2010/07/howto-remove-a-list-of-files/</link>
		<comments>http://linuxsysadminblog.com/2010/07/howto-remove-a-list-of-files/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 21:33:28 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1116</guid>
		<description><![CDATA[Here is a quick tip on how to remove a list of files. Let&#8217;s say you have the list of files inside a file called files_to_remove. Usually I would do something like this:
LIST=`cat files_to_remove`
and then
ls -al $LIST
just to check what is in the list and if it looks good.
And finally:
rm -vf $LIST
]]></description>
			<content:encoded><![CDATA[<p>Here is a quick tip on how to remove a list of files. Let&#8217;s say you have the list of files inside a file called <strong>files_to_remove</strong>. Usually I would do something like this:<br />
<code>LIST=`cat files_to_remove`</code><br />
and then<br />
<code>ls -al $LIST</code><br />
just to check what is in the list and if it looks good.</p>
<p>And finally:<br />
<code>rm -vf $LIST</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/07/howto-remove-a-list-of-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svnadmin: can&#8217;t open file &#8217;svn/db/fsfs.conf&#8217;: No such file or directory</title>
		<link>http://linuxsysadminblog.com/2010/06/svnadmin-cant-open-file-svndbfsfs-conf-no-such-file-or-directory/</link>
		<comments>http://linuxsysadminblog.com/2010/06/svnadmin-cant-open-file-svndbfsfs-conf-no-such-file-or-directory/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 05:37:48 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1105</guid>
		<description><![CDATA[While working on setting up a backup script for a subversion repository I encountred an interesting problem. I&#8217;ve done this before many times, on different repos, and haven&#8217;t seen any issues, but in this case the backup command that is using the built-in svnadmin hotcopy command was failing with this error:
svnadmin hotcopy --clean-logs /svn/repo/ /backup/repo/
svnadmin: [...]]]></description>
			<content:encoded><![CDATA[<p>While working on setting up a <em>backup script for a subversion repository</em> I encountred an interesting problem. I&#8217;ve done this before many times, on different repos, and haven&#8217;t seen any issues, but in this case the backup command that is using the built-in <strong>svnadmin hotcopy</strong> command was failing with this error:<br />
<code>svnadmin hotcopy --clean-logs /svn/repo/ /backup/repo/<br />
svnadmin: Can't open file '/svn/repo/db/fsfs.conf': No such file or directory</code></p>
<p>Hmm&#8230; looking at the respective path I can see that the command is not lying and that file <strong>fsfs.conf</strong> is indeed not present. I could find a file <strong>fs-type</strong> but not fsfs.conf. So my only assumption was that this is an <em>older</em> repository created with an <em>older svn version</em> than the one we were running currently. Checking the existing svn version I got:<br />
<code>svn --version<br />
svn, version 1.6.11 (r934486)<br />
compiled Apr 20 2010, 00:24:22</code><br />
and the fact that this repo was very old (~2009) made my assumption sound correct. Ok, now what? Well in this situation my first thought was to use the <strong>svnadmin upgrade</strong> command; from the manual it looked like this is what I needed to fix this issue:<span id="more-1105"></span></p>
<p><em>&#8220;svnadmin help upgrade<br />
upgrade: usage: svnadmin upgrade REPOS_PATH</em></p>
<p><em>Upgrade the repository located at REPOS_PATH to the latest supported<br />
schema version.</em></p>
<p><em>This functionality is provided as a convenience for repository<br />
administrators who wish to make use of new Subversion functionality<br />
without having to undertake a potentially costly full repository dump<br />
and load operation.  As such, the upgrade performs only the minimum<br />
amount of work needed to accomplish this while still maintaining the<br />
integrity of the repository.  It does not guarantee the most optimized<br />
repository state as a dump and subsequent load would.&#8221;</em></p>
<p>After I&#8217;ve made a manual backup archive of the repo (a simple tar.gz of the repo folder) I ran the upgrade command sure this is going to fix my issue:<br />
<code>svnadmin upgrade /svn/repo/</code><br />
and after it completed, I verified that svn was still working as expected and checked for the fsfs.conf file. But that was <strong>not created</strong>&#8230; Hmm&#8230; Let&#8217;s try the hotcopy command anyway:<br />
<code>svnadmin hotcopy --clean-logs /svn/repo/ /tmp/repo/<br />
svnadmin: Can't open file '/svn/repo/db/fsfs.conf': No such file or directory</code><br />
the exact same error.</p>
<p>Trying to understand what the fsfs.conf file contains I just created a new repository to see if it gets created. Indeed my v1.6.11 of svn created the file for a new repo, and after copying it to the location of my existing repository (as it was basically just an empty file) my issue was fixed and the hotcopy command started working. Here is the content of the file as created by my svn version, that I copied in the older repo to fix this problem:</p>
<pre><code>cat fsfs.conf
### This file controls the configuration of the FSFS filesystem.

[memcached-servers]
### These options name memcached servers used to cache internal FSFS
### data.  See http://www.danga.com/memcached/ for more information on
### memcached.  To use memcached with FSFS, run one or more memcached
### servers, and specify each of them as an option like so:
# first-server = 127.0.0.1:11211
# remote-memcached = mymemcached.corp.example.com:11212
### The option name is ignored; the value is of the form HOST:PORT.
### memcached servers can be shared between multiple repositories;
### however, if you do this, you *must* ensure that repositories have
### distinct UUIDs and paths, or else cached data from one repository
### might be used by another accidentally.  Note also that memcached has
### no authentication for reads or writes, so you must ensure that your
### memcached servers are only accessible by trusted users.

[caches]
### When a cache-related error occurs, normally Subversion ignores it
### and continues, logging an error if the server is appropriately
### configured (and ignoring it with file:// access).  To make
### Subversion never ignore cache errors, uncomment this line.
# fail-stop = true

[rep-sharing]
### To conserve space, the filesystem can optionally avoid storing
### duplicate representations.  This comes at a slight cost in performace,
### as maintaining a database of shared representations can increase
### commit times.  The space savings are dependent upon the size of the
### repository, the number of objects it contains and the amount of
### duplication between them, usually a function of the branching and
### merging process.
###
### The following parameter enables rep-sharing in the repository.  It can
### be switched on and off at will, but for best space-saving results
### should be enabled consistently over the life of the repository.
# enable-rep-sharing = false</code></pre>
<p>Hopefully this will help others seeing the same issue I was experiencing.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/06/svnadmin-cant-open-file-svndbfsfs-conf-no-such-file-or-directory/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Enable/Disable APC on virtual host level</title>
		<link>http://linuxsysadminblog.com/2010/03/enabledisable-apc-on-virtual-host-level/</link>
		<comments>http://linuxsysadminblog.com/2010/03/enabledisable-apc-on-virtual-host-level/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 21:53:29 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1069</guid>
		<description><![CDATA[APC (Alternative PHP Cache) is a free, open, and robust framework for caching and optimizing PHP intermediate code. APC is a great tool to speed up a php driven site and I can&#8217;t even think of a big site running on a php framework without an opcode cache (other good choices are eaccelerator or xcache). [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pecl.php.net/package/APC" target="_blank"><strong>APC</strong></a> (Alternative PHP Cache) is a free, open, and robust framework for caching and optimizing PHP intermediate code. <strong>APC</strong> is a great tool to speed up a php driven site and I can&#8217;t even think of a big site running on a php framework without an <em>opcode cache</em> (other good choices are <strong>eaccelerator</strong> or <strong>xcache</strong>). Why would not everyone want to use this? The reason why this is not enabled by default everywhere is because in certain situations it can break things. Most peoples will not see any problems, but still, if you run a server with many clients sharing the same apache service this might be a problem (as the apc module loading it is a server-wide config). This post will show how we can use APC globally and disable it for some vhosts (that might have a problem with using APC) or the reverse to just use it one a special vhost that might need this.</p>
<p>I&#8217;ll assume that you have installed apc already, if this is not the case this will probably be something as simple as running<br />
<code>pecl install apc</code><br />
or downloading the archive from pecl and running:<br />
<code>phpize; ./configure; make; make install</code></p>
<p>The APC extension needs to be enabled either in <strong>php.ini</strong> or in one included file with a line like this:<br />
<code>extension=apc.so</code><br />
there are many other parameters that apc can be fine tuned (see the official doc for more info), but without any other change, just with this line apc will be enabled on all the vhosts on the server.</p>
<p><strong>Disabling some vhosts from using APC</strong><br />
- if we want to disable APC for a particular vhost we just have to add to the vhost config or to .htaccess:<br />
<code>php_flag apc.cache_by_default Off</code></p>
<p><strong>Enabling APC only on some vhosts</strong><br />
- if we want to have APC disabled by default globally we will have in php.ini:</p>
<pre><code>extension=apc.so
[apc]
apc.cache_by_default=0 # disable by default
... other apc settings...</code></pre>
<p>and we will enable APC for the particular vhost config or using .htaccess using:<br />
<code>php_flag apc.cache_by_default On</code></p>
<p>Hopefully you found this post useful and this will give you a reason to use APC with more confidence knowing that you have the granularity to disable/enable it as needed in a shared environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/03/enabledisable-apc-on-virtual-host-level/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problem Moving Drupal Site With SecurePages Module Enabled</title>
		<link>http://linuxsysadminblog.com/2010/02/problem-moving-drupal-site-with-securepages-module-enabled/</link>
		<comments>http://linuxsysadminblog.com/2010/02/problem-moving-drupal-site-with-securepages-module-enabled/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 12:41:23 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[securepages]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1058</guid>
		<description><![CDATA[I made a copy of Drupal6 site with SecurePages module installed and configured.  This module is configured to redirect all or certain pages to https &#8211; depending on your configurations.  For our setup we usually include the login and admin sections to redirect to https.
The problem is on the copied site that is [...]]]></description>
			<content:encoded><![CDATA[<p>I made a copy of Drupal6 site with <a href="http://drupal.org/project/securepages">SecurePages</a> module installed and configured.  This module is configured to redirect all or certain pages to https &#8211; depending on your configurations.  For our setup we usually include the login and admin sections to redirect to https.</p>
<p>The problem is on the copied site that is on a new domain as we cannot login and go to the admin section because it redirect back to the source/original site.  What we need is either disable the securepages module or update the domains.  To do this, you need to access your database (ex: phpmyadmin, etc), go to <em>variable</em> table, and search for <em>securepages</em> configurations. </p>
<p>If you want to disable the module change:<br />
<code>securepages_enable  s:1:"<strong>1</strong>";</code><br />
to<br />
<code>securepages_enable  s:1:"<strong>0</strong>";</code></p>
<p>Or if you want to update the domain change:<span id="more-1058"></span><br />
<code>securepages_basepath s:30:"http://<strong>www.domain.com</strong>";<br />
securepages_basepath_ssl s:31:"https://<strong>www.domain.com</strong>";</code><br />
to<br />
<code>securepages_basepath s:30:"http://<strong>www.newdomain.com</strong>";<br />
securepages_basepath_ssl s:31:"https://<strong>www.newdomain.com</strong>";</code></p>
<p>After making the above changes <strong>don&#8217;t forget</strong> to run the update.php (http://www.newdomain.com/update.php)</p>
<p>If you want to uninstall the module, try removing the securepages directory and run update.php.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/02/problem-moving-drupal-site-with-securepages-module-enabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Changes to Drupal Core</title>
		<link>http://linuxsysadminblog.com/2010/02/making-changes-to-drupal-core/</link>
		<comments>http://linuxsysadminblog.com/2010/02/making-changes-to-drupal-core/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 05:42:10 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1040</guid>
		<description><![CDATA[Although we made it a standard not to make any changes to Drupal core and core modules, there are times that our developers really need to make changes to core modules in order to add the required functionality.  Cases like additional feature for &#8216;user&#8217; or &#8216;comment&#8217; modules and so on.  At this state [...]]]></description>
			<content:encoded><![CDATA[<p>Although we made it a standard not to make any changes to Drupal core and core modules, there are times that our developers really need to make changes to core modules in order to add the required functionality.  Cases like additional feature for &#8216;user&#8217; or &#8216;comment&#8217; modules and so on.  At this state we can&#8217;t perform automatic update on our sites as we might overwrite the changes &#8211; so we need to do the update manually.  Well, this is ok if you maintain one or two sites, but if you have more than 100 sites then it will take you some time.</p>
<p>What we did to eliminate this issue and be able to update the site automatically was to create a copy of the original core modules (located in <em>/modules</em>), add our custom functionality, and put the modified copy into &#8216;contributed&#8217; modules directory (<em>/sites/all/modules</em>).  Drupal read the modules found on <em>/sites/all/modules</em> first and ignore the same copy (original) found on <em>/modules</em>.  Also, may want to change the module info or the package name to separate the modified modules from the original ones &#8211; ex: modified_core, custom, etc.  In the case that Drupal reads both of them, you can just disable the other one.</p>
<p>Here&#8217;s our policy on working with Drupal modules:<br />
  &#8211; contributed or community modules at <em>/sites/all/modules</em><br />
  &#8211; custom made modules at <em>/sites/all/modules/custom</em><br />
  &#8211; modified core modules at <em>/sites/all/modules/core_modified</em></p>
<p>Hope this helps.  <img src='http://linuxsysadminblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/02/making-changes-to-drupal-core/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cvs [checkout aborted]: absolute pathnames invalid for server</title>
		<link>http://linuxsysadminblog.com/2010/02/cvs-checkout-aborted-absolute-pathnames-invalid-for-server/</link>
		<comments>http://linuxsysadminblog.com/2010/02/cvs-checkout-aborted-absolute-pathnames-invalid-for-server/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 09:44:00 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[cvs]]></category>
		<category><![CDATA[drupa update]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1030</guid>
		<description><![CDATA[Absolute Path Error:
  cvs [checkout aborted]: absolute pathnames invalid for server (specified `/path/drupalsite/')
Ok, I got the error above when I performed Drupal CVS update on our Debian server (newly installed CVS 1.12.13).  The same command works on other server with older CVS installation.  The issue is the reference to local cvs directory [...]]]></description>
			<content:encoded><![CDATA[<p>Absolute Path Error:<br />
<code>  cvs [checkout aborted]: absolute pathnames invalid for server (specified `/path/drupalsite/')</code></p>
<p>Ok, I got the error above when I performed Drupal CVS update on our Debian server (newly installed CVS 1.12.13).  The same command works on other server with older CVS installation.  The issue is the reference to local cvs directory where I used absolute path (-d /path/drupalsite/), which is a bug (security hole on client side) &#8211; it was fixed on newer CVS version to use relative path.</p>
<p>Drupal Checkout Command:<br />
<code>  cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-6-15 -d /path/drupalsite/ drupal</code></p>
<p>Use of Relative Path (sample)<br />
<code>  cd /path<br />
  cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-6-15 -d drupalsite drupal</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/02/cvs-checkout-aborted-absolute-pathnames-invalid-for-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Squid outgoing address</title>
		<link>http://linuxsysadminblog.com/2009/10/change-squid-outgoing-address/</link>
		<comments>http://linuxsysadminblog.com/2009/10/change-squid-outgoing-address/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 18:45:34 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[Installation]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=898</guid>
		<description><![CDATA[Typically Squid caching proxy server listen and outgoing IP address are the same. Sometimes, for various reasons we want to alter the outgoing IP address. The new address must first be brought up as an interface on the squid server. In squid.conf look for tcp_outgoing_address line, uncomment it and replace the default IP value with [...]]]></description>
			<content:encoded><![CDATA[<p>Typically <a href="http://www.squid-cache.org">Squid</a> caching proxy server listen and outgoing IP address are the same. Sometimes, for various reasons we want to alter the <strong>outgoing IP</strong> address. The new address must first be brought up as an interface on the squid server. In squid.conf look for <code>tcp_outgoing_address</code> line, uncomment it and replace the default IP value with your new outgoing ip address and restart Squid. Your Squid server will still listen and accept connections on the current IP while all outbound traffic will originate from the new IP. This modification works with access ACL and detailed instructions can be found <a href="http://www.squid-cache.org/Versions/v3/3.0/cfgman/tcp_outgoing_address.html">here</a> for latest stable branch (3.0)</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/10/change-squid-outgoing-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo display PHP errors when you don&#8217;t have access to php.ini</title>
		<link>http://linuxsysadminblog.com/2009/09/howto-display-php-errors-when-you-dont-have-access-to-php-ini/</link>
		<comments>http://linuxsysadminblog.com/2009/09/howto-display-php-errors-when-you-dont-have-access-to-php-ini/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 12:10:34 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=867</guid>
		<description><![CDATA[If you are using a shared server, or just have a limited account on your company servers, you might not have access to your php configuration file php.ini (this is usually found under /etc/php.ini in rhel/centos and /etc/php5/apache2/php.ini in debian/ubuntu). Still, in many situations it might be needed to enable php errors in the browser [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using a shared server, or just have a limited account on your company servers, you might <strong>not have access</strong> to your php configuration file <strong>php.ini</strong> (this is usually found under <em>/etc/php.ini</em> in rhel/centos and <em>/etc/php5/apache2/php.ini</em> in debian/ubuntu). Still, in many situations it might be needed to <strong>enable php errors</strong> in the browser so you can see what is the actual problem instead of an empty page (if the server has error reporting disabled as most production systems should have).</p>
<p>In order to enable error reporting for your php script or application include inside your code the following lines:<br />
<code>error_reporting(E_ALL);<br />
ini_set("display_errors", 1);</code><br />
and this will result in displaying in the browser any errors your application might have.</p>
<p>ps: once you are done with this and fixed the issue, don&#8217;t forget to remove the error reporting lines, as we don&#8217;t want our users/clients to see errors in the browser in case something went wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/09/howto-display-php-errors-when-you-dont-have-access-to-php-ini/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using wildcards in nginx valid_referers</title>
		<link>http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/</link>
		<comments>http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 11:05:25 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=833</guid>
		<description><![CDATA[This quick post will show how we can easily allow only certain http referrers see some location using nginx. This might be useful for example if you are using nginx as a static content provider and want to not allow everyone hot-linking your images and only your own sites. Doing something like this in nginx [...]]]></description>
			<content:encoded><![CDATA[<p>This quick post will show how we can easily allow only certain http referrers see some location using <a href="http://nginx.net/" target="_blank"><strong>nginx</strong></a>. This might be useful for example if you are using nginx as a static content provider and want to not allow everyone hot-linking your images and only your own sites. Doing something like this in nginx is very simple and we could start with a configuration like this (from <em>nginx.conf</em>):</p>
<pre><code>location /images {
	valid_referers   none  blocked  server_names  mydomain.com www.mydomain.com;
	if ($invalid_referer) {
		return   403;
	}
	... else serve the content
}</code></pre>
<p>This works fine in this simple case; but what if we need to list more sub-domains? like images.mydomain.com an static.mydomain.com, etc? It would be nice to be able to use a regexp for this, right? Fortunately nginx has support for this and this can be done using a valid_referers line like:<br />
<code>valid_referers   none  blocked  server_names  ~(mydomain.com)</code></p>
<p><span id="more-833"></span>And this will match all the subdomains *.mydomain.com. Going even further you might want to allow google as a referrer for you content. Still google has so many subdomains and even different domains (like google.com, google.de, etc.) For this we could add ~(google.) and have our final configuration look like this:</p>
<pre><code>location /images {
	valid_referers   none  blocked  server_names  ~(mydomain.com|google.);
	if ($invalid_referer) {
		return   403;
	}
	... else serve the content
}</code></pre>
<p>This simple example shows how powerful the configuration of nginx is and how easy it is to do things that are rather impossible with other similar softwares.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/08/using-wildcards-in-nginx-valid_referers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using svn+ssh with a non-standard ssh port</title>
		<link>http://linuxsysadminblog.com/2009/08/using-svnssh-with-a-non-standard-ssh-port/</link>
		<comments>http://linuxsysadminblog.com/2009/08/using-svnssh-with-a-non-standard-ssh-port/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 09:25:05 +0000</pubDate>
		<dc:creator>marius</dc:creator>
				<category><![CDATA[CLI]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=829</guid>
		<description><![CDATA[Many people use subversion over ssh for a simple and secure way to work on remotely hosted svn repositories. This is normally as simple as running:
svn co svn+ssh://user@server/repo .
If the remote ssh server is not running on the default ssh port (tcp 22) then this needs a little tweaking to get it working. Normally I [...]]]></description>
			<content:encoded><![CDATA[<p>Many people use <a href="http://subversion.tigris.org/" target="_blank"><strong>subversion</strong></a> over ssh for a simple and secure way to work on remotely hosted svn repositories. This is normally as simple as running:<br />
<code>svn co svn+ssh://user@server/repo .</code></p>
<p>If the remote ssh server is <strong>not running on the default ssh port</strong> (tcp 22) then this needs a little tweaking to get it working. Normally I was expecting that adding a custom entry for the svn server in the <em>/etc/ssh/ssh_config</em> file with the appropriate port would make this work on the fly without changing the command line; or if not, adding the ssh port in &#8216;telnet like&#8217; way: <em>server:port</em> would make a difference. Still none of those worked and in order to get this working I had to dig into the subversion documentation on how we can define a special tunnel.</p>
<p>We can define a new tunnel in the svn configuration file (<strong>.subversion/config</strong>):<br />
<code>[tunnels]<br />
sshtunnel = ssh -p &lt;port&gt;</code></p>
<p>And after this we can use svn as usual but with a url like <strong>svn+sshtunnel://</strong> :<br />
<code>svn co svn+sshtunnel://user@server/repo .</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/08/using-svnssh-with-a-non-standard-ssh-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
