<?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>Blog dot Melimato dot Com &#187; apache</title>
	<atom:link href="http://blog.melimato.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.melimato.com</link>
	<description>Those things we do</description>
	<lastBuildDate>Thu, 24 Dec 2009 11:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Using apache&#8217;s RedirectMatch instead of ServerAlias to avoid content duplication</title>
		<link>http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/</link>
		<comments>http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/#comments</comments>
		<pubDate>Mon, 18 May 2009 00:30:14 +0000</pubDate>
		<dc:creator>pablo</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/</guid>
		<description><![CDATA[Most web sites I do have many domains but want all those domains to point to the &#8220;main domain&#8221; www.domain.com. My first solution was to put Apaches&#8217;s directive ServerAlias in the site&#8217;s virtual host configuration. This lead to content duplication since domain.com and domain.net and www.domain.com are two different web sites for the rest of [...]]]></description>
			<content:encoded><![CDATA[<p>Most web sites I do have many domains but want all those domains to point to the &#8220;main domain&#8221; www.domain.com. My first solution was to put Apaches&#8217;s directive <a href="http://httpd.apache.org/docs/2.0/mod/core.html#serveralias">ServerAlias</a> in the site&#8217;s virtual host configuration. This lead to content duplication since domain.com and domain.net and www.domain.com are two different web sites for the rest of the world. To avoid this problem the only solution I&#8217;ve found was to create two different virtual hosts and set Apache&#8217;s <a href="http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect">Redirect</a> directive. The first VirtualHost will hold all the domains aliases and redirect permanently (301) to the &#8220;main domain&#8221;</p>
<p><span id="more-116"></span></p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">&lt;VirtualHost ip_address:80&gt;
    ServerName domain.com
    ServerAlias domain.net
    ServerAlias domain.biz
    RedirectMatch permanent /(.*) http://www.domain.com/$1
&lt;/VirtualHost&gt;
&nbsp;
&lt;VirtualHost ip_address:80&gt;
    ServerName www.domain.com
    etc...
&lt;/VirtualHost&gt;</pre></div></div>

<div id="wherego_related"> </div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/using-apaches-redirectmatch-instead-of-serveralias-to-avoid-content-duplication/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Set new logrotate tasks to rotate apache logs in non-standard directories</title>
		<link>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/</link>
		<comments>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 15:52:36 +0000</pubDate>
		<dc:creator>pablo</dc:creator>
				<category><![CDATA[logrotate]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>

		<guid isPermaLink="false">http://www.melimato.com/blog/?p=64</guid>
		<description><![CDATA[I prefer compressing old logs to save space. Edit logrotate.conf vi /etc/logrotate.conf Uncomment the following line: compress Since I keep all my hosting&#8217;s logs in /home/hosting/log I need to add a new task to logrotate: Create a new file under logrotate.d called hosting: vi /etc/logrotate.d/hosting Add the following contents to that file: /home/hosting/*/log/*.log &#123; weekly [...]]]></description>
			<content:encoded><![CDATA[<p>I prefer compressing old logs to save space. Edit logrotate.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.conf</pre></div></div>

<p><span id="more-64"></span></p>
<p>Uncomment the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">compress</pre></div></div>

<p>Since I keep all my hosting&#8217;s logs in /home/hosting/log I need to add a new task to logrotate:</p>
<p>Create a new file under logrotate.d called hosting:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.d<span style="color: #000000; font-weight: bold;">/</span>hosting</pre></div></div>

<p>Add the following contents to that file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>hosting<span style="color: #000000; font-weight: bold;">/*/</span>log<span style="color: #000000; font-weight: bold;">/*</span>.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  weekly
    missingok
    rotate <span style="color: #000000;">52</span>
    compress
    delaycompress
    notifempty
    create <span style="color: #000000;">640</span> root adm
    sharedscripts
    postrotate
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
            <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 reload <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
        <span style="color: #000000; font-weight: bold;">fi</span>
    endscript
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Explanation of script lines according to man page:</p>
<p><strong>missingok</strong><br />
If the log file is missing, go on to the next one without issuing an error message.</p>
<p><strong>rotate</strong> <em>count</em><br />
Log files are rotated <count> times before being removed or mailed to the address specified in a mail directive. If count is 0, old versions are removed rather then rotated.<br />
In our case we will remove logfiles older than 1 year (52 weeks)</p>
<p><strong>compress</strong><br />
Duh!</p>
<p><strong>delaycompress</strong><br />
Postpone compression of the previous log file to the next rotation cycle. This has only effect when used in combination with compress. It can be used when some program can not be told to close its logfile and thus might continue writing to the previous log file for some time.</p>
<p><strong>notifempty</strong><br />
Do not rotate the log if it is empty (this overrides the ifempty option).</p>
<p><strong>create</strong> <em>mode owner group</em><br />
Immediately after rotation (before the postrotate script is run) the log file is created (with the same name as the log file just rotated).  mode specifies the mode for the log file in octal (the same as chmod(2)), owner specifies the user name who will own the log file, and group specifies the group the log file will belong to. Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes. This option can be disabled using the nocreate option.</p>
<p><strong>sharedscripts</strong><br />
Normally, <strong>prescript</strong> and <strong>postscript</strong> scripts are run for each log which is rotated, meaning that a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If <strong>sharedscript</strong> is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern. However, if none of the logs in the pattern require rotating, the scripts will not be run at all. This option overrides the nosharedscripts option and implies <strong>create</strong> option.<br />
<strong>postrotate/endscript</strong><br />
The lines between postrotate and endscript (both of which must appear on lines by themselves) are executed after the log file is rotated. These directives may only appear inside of a log file definition.</p>
<div id="wherego_related"><h3>Readers who viewed this page, also viewed:</h3><ul><li><a href="http://blog.melimato.com/svn-setup-and-migration/" rel="bookmark" class="wherego_title">svn setup and migration</a></li><li><a href="http://blog.melimato.com/make-svnserve-load-on-startup-ubuntu/" rel="bookmark" class="wherego_title">Make svnserve load on startup (Ubuntu)</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/where-did-they-go-from-here/">Where did they go from here?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.melimato.com/set-new-logrotate-tasks-to-rotate-apache-logs-in-non-standard-directories/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
