<?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>George Papayiannis &#187; Linux</title>
	<atom:link href="http://www.sematopia.com/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sematopia.com</link>
	<description></description>
	<lastBuildDate>Mon, 21 Nov 2011 23:18:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>The pain of sending email</title>
		<link>http://www.sematopia.com/2011/01/the-pain-of-sending-email/</link>
		<comments>http://www.sematopia.com/2011/01/the-pain-of-sending-email/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 04:06:11 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=613</guid>
		<description><![CDATA[Last night I decided to finally try and understand why some of the emails I was sending was getting caught in spam filters, particularly Yahoo and Hotmail. So it began. #0 Read this. Get the basics. #1 To test everything out, send yourself an email to a GMail account. When viewing the message, click the [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I decided to finally try and understand why some of the emails I was sending was getting caught in spam filters, particularly Yahoo and Hotmail.  So it began.</p>
<p>#0 Read <a href="http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html">this</a>.  Get the basics.</p>
<p>#1 To test everything out, send yourself an email to a GMail account.  When viewing the message, click the drop down and click &#8220;View Original&#8221;.  From there you will be able to see the return-path and comments on the SPF.</p>
<p>#2</p>
<p>Make sure the return-path is set correctly in your code.  This return-path will be used to do the reverse ptr lookup.  In PHP Pear Mail that meant:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>$mail =&#038; Mail::factory('mail', array('Return-Path' => sprintf("-f %s", 'xxxx@abc.com')));</pre>
</div>
<p></code></div>
</div>
<p>#2</p>
<p>Read <a href="http://forums.serverbeach.com/showthread.php?t=5469">this</a>.  You need to request your hosting provider, in my case ServerBeach, to update your IPs SPF record.</p>
<p>Then the txt spf record needs to be updated to allow permit the server IP:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>v=spf1 ip4:11.11.111.11 include:_spf.google.com ~all</pre>
</div>
<p></code></div>
</div>
<p>#3</p>
<p>Setting up DKIM is hard.  Read <a href="http://stackoverflow.com/questions/2799611/setting-up-domainkeys-dkim-in-a-php-based-smtp-client">this</a>.  I&#8217;m using Exim4 and by default DKIM support is <a href="http://www.exim.org/exim-html-current/doc/html/spec_html/ch54.html">built in</a>.  To do it read <a href="http://mikepultz.com/2010/02/using-dkim-in-exim/">this</a>.  But you&#8217;ll quickly realize that won&#8217;t work on etch!  So you need to upgrade to Lenny and then make sure the lenny backports are on, because you need to go to exim 4.7+</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre># Main
deb http://http.us.debian.org/debian/ stable main non-free contrib
# Source
deb-src http://http.us.debian.org/debian/ stable main non-free contrib
# Security
deb http://security.debian.org/ stable/updates main contrib non-free
# backports for lenny
deb http://backports.debian.org/debian-backports lenny-backports main</pre>
</div>
<p></code></div>
</div>
<p>So now install the backports version of exim after you&#8217;ve upgraded Debian to Lenny:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get -t lenny-backports install exim4</pre>
</div>
<p></code></div>
</div>
<p>Basically create the keys in the exim config directories /etc/exim4/:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>openssl genrsa -out dkim.private.key 768
openssl rsa -in dkim.private.key -out dkim.public.key -pubout -outform PEM</pre>
</div>
<p></code></div>
</div>
<p>Then update the file exim4.conf.template:</p>
<p>Make sure the dkim_private_key is to a fully qualified path</p>
<blockquote><p>
driver = smtp<br />
dkim_domain = example.com<br />
dkim_selector = x<br />
dkim_private_key = /etc/exim4/dkim.private.key<br />
dkim_canon = relaxed
</p></blockquote>
<p>Then update DNS with the txt entry and it should work.  Just remember George you can&#8217;t do this in etch, you need to be in lenny and using exim > 4.70.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2011/01/the-pain-of-sending-email/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The pain of a new server setup</title>
		<link>http://www.sematopia.com/2010/12/the-pain-of-a-new-server-setup/</link>
		<comments>http://www.sematopia.com/2010/12/the-pain-of-a-new-server-setup/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 06:33:25 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=598</guid>
		<description><![CDATA[Setup a new server on SB etchy, true to form, the pain of setting up the server ensues.. For some reason /etc/apt/sources.list is off, by default had: Code: # Main deb http://http.us.debian.org/debian/ etch main non-free contrib # Source deb-src http://http.us.debian.org/debian/ etch main non-free contrib # Security deb http://security.debian.org/ etch/updates main contrib non-free Changed it to: [...]]]></description>
			<content:encoded><![CDATA[<p>Setup a new server on SB etchy, true to form, the pain of setting up the server ensues..</p>
<p>For some reason /etc/apt/sources.list is off, by default had:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre># Main
deb http://http.us.debian.org/debian/ etch main non-free contrib
# Source
deb-src http://http.us.debian.org/debian/ etch main non-free contrib
# Security
deb http://security.debian.org/ etch/updates main contrib non-free</pre>
</div>
<p></code></div>
</div>
<p>Changed it to:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre># Main
deb http://http.us.debian.org/debian/ stable main non-free contrib
# Source
deb-src http://http.us.debian.org/debian/ stable main non-free contrib
# Security
deb http://security.debian.org/ stable/updates main contrib non-free</pre>
</div>
<p></code></div>
</div>
<p>Installed apt-get install apache2, but didn&#8217;t know how to check that worker was installed by default:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apache2 -l
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  worker.c
  http_core.c
  mod_so.c

apt-get install php5 libapache2-mod-php5</pre>
</div>
<p></code></div>
</div>
<p>And then I realized PHP should not run with worker in a production env:</p>
<blockquote><p>62.1. Why shouldn&#8217;t I use Apache2 with a threaded MPM in a production environment?</p>
<p>PHP is glue. It is the glue used to build cool web applications by sticking dozens of 3rd-party libraries together and making it all appear as one coherent entity through an intuitive and easy to learn language interface. The flexibility and power of PHP relies on the stability and robustness of the underlying platform. It needs a working OS, a working web server and working 3rd-party libraries to glue together. When any of these stop working PHP needs ways to identify the problems and fix them quickly. When you make the underlying framework more complex by not having completely separate execution threads, completely separate memory segments and a strong sandbox for each request to play in, feet of clay are introduced into PHP&#8217;s system.</p>
<p>If you feel you have to use a threaded MPM, look at a FastCGI configuration where PHP is running in its own memory space.</p>
<p>And finally, this warning against using a threaded MPM is not as strong for Windows systems because most libraries on that platform tend to be threadsafe.
</p></blockquote>
<p>Setup Memcaches: http://www.sematopia.com/2009/03/setting-up-memcached-on-ubuntudebian-and-windows-xampp/</p>
<p>Disable Etags:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>sudo a2enmod headers
sudo /etc/init.d/apache2 restart

Header unset ETag
FileETag None</pre>
</div>
<p></code></div>
</div>
<p>Install Subversion:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get install subversion
apt-get install php-pear</pre>
</div>
<p></code></div>
</div>
<p>Intall APC:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get install apache2-dev php5-dev php-pear make
ln -s /usr/bin/apxs2 /usr/bin/apxs
pecl install apc</pre>
</div>
<p></code></div>
</div>
<p>Install Mysql:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get install mysql-client mysql-common mysql-server php5-mysql</pre>
</div>
<p></code></div>
</div>
<p>Add to apache2.conf:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>AliasMatch \.svn /non-existant-page
Options -Indexes

Header unset ETag
FileETag None

&#60;FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2015 20:00:00 GMT"
&#60;/FilesMatch></pre>
</div>
<p></code></div>
</div>
<p>Enable mod-rewrite</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>a2enmod rewrite</pre>
</div>
<p></code></div>
</div>
<p>Install SSL:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get install openssl ssl-cert</pre>
</div>
<p></code></div>
</div>
<p>Configure Exim4 (cause by default does not support external mail sending)</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>dpkg-reconfigure exim4-config</pre>
</div>
<p></code></div>
</div>
<p>Change the time zone to est:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>dpkg-reconfigure tzdata</pre>
</div>
<p></code></div>
</div>
<p>Add spelling:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get install php5-pspell
apt-get install aspell-en</pre>
</div>
<p></code></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2010/12/the-pain-of-a-new-server-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing PECL Filter on Debian Linux (AMD64)</title>
		<link>http://www.sematopia.com/2008/10/installing-pecl-filter-on-debian-linux-amd64/</link>
		<comments>http://www.sematopia.com/2008/10/installing-pecl-filter-on-debian-linux-amd64/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 23:32:46 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=263</guid>
		<description><![CDATA[I just finished installing the PECL filter extension on my Debian install (AMD64), and by God, it was painful. This process was so brutal with so many ways to screw up. Here are the steps: Install php5-dev package. During the process of not figuring out what was going on, I also installed the php4-dev package. [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished installing the PECL filter extension on my Debian install (AMD64), and by God, it was painful.  This process was so brutal with so many ways to screw up.  Here are the steps:</p>
<p>Install php5-dev package.  During the process of not figuring out what was going on, I also installed the php4-dev package.  I&#8217;m pretty sure I only needed php5-dev.</p>
<p>Download PCRE &#8211; Perl Compatible Regular Expressions <a href="http://www.pcre.org/">from here</a>.  Be sure you have g++ installed (not just gcc as I was getting a strange error).  Extract, configure, make and make install.  If your running AMD64, be sure to compile using the -fPIC flag.  <a href="http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&#038;chap=3">See here for information why</a>.  Filter will look for the library in /usr/local/, so you&#8217;ll have to setup a link or copy it from /usr/local/lib/ so the PECL install can find it.</p>
<p>The Filter package also looks for the header files from the php_pcre extension.  The only way I found to get at these header files was to download the PHP source.  So depending on what version of PHP you have, <a href="http://www.php.net/downloads.php">go here</a> and download the zip.  Copy the entire pcre folder from within the extension (ext) folder into your /usr/include/php5/ext/ folder.</p>
<p>Now it&#8217;s time to attempt the actual PECL Filter install.  If your doing this from the tarball and your running on an AMD64, as above, be sure to add the -fPIC flag.  I used the PECL installer, so I ran: pecl install filter.  Since the package is not &#8220;stable&#8221; yet, you&#8217;ll need to point right to the channel, just read the message, in my case it was: pecl install channel://pecl.php.net/filter-0.11.0.  After the compile/install is done, add extension=filter.so to your php.ini file.  If you can&#8217;t find it, type find / -name php.ini from your command line.</p>
<p>That&#8217;s it.  I may have forgotten a step, if so add a comments please.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2008/10/installing-pecl-filter-on-debian-linux-amd64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Linux: Generate Thumbnail Image of External URL</title>
		<link>http://www.sematopia.com/2007/10/ubuntu-linux-generate-thumbnail-image-of-external-url/</link>
		<comments>http://www.sematopia.com/2007/10/ubuntu-linux-generate-thumbnail-image-of-external-url/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 18:22:31 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=219</guid>
		<description><![CDATA[This was surprisingly a lot harder to figure out than I initially expected. I was doing a lot of searching and kept finding either solutions for windows or packages that cost money. To add to the problem, I needed a solution that ran in a command line only version of Linux (Ubuntu Server). I guess [...]]]></description>
			<content:encoded><![CDATA[<p>This was surprisingly a lot harder to figure out than I initially expected.  I was doing a lot of searching and kept finding either solutions for windows or packages that cost money.  To add to the problem, I needed a solution that ran in a command line only version of Linux (Ubuntu Server).  I guess I was naive to think the PHP gd library would support this.  After a lot of digging last night, I found <a href="http://www.boutell.com/webthumb">webthumb</a>.  Getting it work was surprisingly easy using the instructions provided, just replace mozilla for firefox and add the xwd package:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>apt-get install xvfb
apt-get install firefox
apt-get install netpbm
apt-get install xwd

wget http://www.boutell.com/webthumb/webthumb.tar.gz
tar xvzf webthumb.tar.gz
cd webth*
./webthumb http://www.sematopia.com/ | pnmscale -xysize 100 100 | pnmtojpeg > thumb.jpg</pre>
</div>
<p></code></div>
</div>
<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2007/10/ubuntu-linux-generate-thumbnail-image-of-external-url/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Apache SVN: Auto-Update Server Copy on Commit</title>
		<link>http://www.sematopia.com/2007/10/apache-svn-auto-update-server-copy-on-commit/</link>
		<comments>http://www.sematopia.com/2007/10/apache-svn-auto-update-server-copy-on-commit/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 04:32:06 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=218</guid>
		<description><![CDATA[It seems these days I spend more time figuring out annoying problems rather than doing any real work. The following gave me another big headache: Getting SVN to auto-update properly via it&#8217;s hooks. SVN provides you the ability to specify hooks after certain events occur with the repository in question. For example, say you have [...]]]></description>
			<content:encoded><![CDATA[<p>It seems these days I spend more time figuring out annoying problems rather than doing any real work.  The following gave me another big headache: Getting SVN to auto-update properly via it&#8217;s hooks.  SVN provides you the ability to specify hooks after certain events occur with the repository in question.  For example, say you have a live application under version control and you want SVN to auto-update the live copy (on the server) after every commit.  I guess that makes sense, especially if you want to develop and test in your production environment, on the fly.</p>
<p>In the directory were your repository exists there should be a <strong>hooks</strong> directory.  This directory includes a bunch of tmpl files that get called depending on the event that just occurred.  The file that I cared about was the post-commit.tmpl file.</p>
<p>Assuming your running SVN using Apache, then most likely when your post-commit script gets called it will be executed using the user www-data.  This is important because it means your repository needs to be checked out via the same user to ensure no permission problems occur.  Assuming that OK, then add the following line to your post-commit.tmpl file:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>/usr/bin/svn update &#60;path to repo> --username xxxxxx --password xxxxxx</pre>
</div>
<p></code></div>
</div>
<p>Hardcoding your SVN password in the file is probably not the best idea, but if your the only one who would have access to the file, then who cares.  Notice how I put a full path to SVN, that&#8217;s because when the hook scripts get called all environment variables, etc. get removed.  The next step, and probably most important, rename the file removing the .tmpl extension and change the ownership so the file becomes executable.</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>cp post-commit.tmpl post-commit
chmod +x post-commit</pre>
</div>
<p></code></div>
</div>
<p>That should do it, so when you update your repository, SVN should auto-update your live working copy.  Most likely you&#8217;ll run into problems, if so check the links below for more info.</p>
<p><a href="http://www.petefreitag.com/item/244.cfm">Helpful Link #1</a><br />
<a href="http://subversion.tigris.org/faq.html#website-auto-update">Helpful Link #2</a><br />
<a href="http://subversion.tigris.org/faq.html#hook-debugging">Helpful Link #3</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2007/10/apache-svn-auto-update-server-copy-on-commit/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Apache: Forwarding Requests to Another Server</title>
		<link>http://www.sematopia.com/2007/09/apache-forwarding-requests-to-another-server/</link>
		<comments>http://www.sematopia.com/2007/09/apache-forwarding-requests-to-another-server/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 03:55:05 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=217</guid>
		<description><![CDATA[This caused me a headache tonight. I&#8217;ll explain below how to forward requests from one Apache HTTP server to another on your network. Here are the main characters: Server0: Your primary HTTP webserver that all external requests come to initially. Server1: A secondary server you have setup (with Apache) to handle requests for xyz.com. The [...]]]></description>
			<content:encoded><![CDATA[<p>This caused me a headache tonight.  I&#8217;ll explain below how to forward requests from one Apache HTTP server to another on your network.  Here are the main characters:</p>
<p><strong>Server0</strong>: Your primary HTTP webserver that all external requests come to initially.<br />
<strong>Server1</strong>: A secondary server you have setup (with Apache) to handle requests for xyz.com.  The (internal) server IP is 192.168.2.10.</p>
<p>At the heart of making this possible is the mod_rewrite module available with Apache.  This module seems very powerful and I only understand a small portion of it.  First off you need to enable mod_rewrite and mod_proxy on Server0:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>a2enmod rewrite
a2enmod proxy
/etc/init.d/apache2 force-reload</pre>
</div>
<p></code></div>
</div>
<p>mod_proxy needs to be enabled and configured (proxy.conf), otherwise Apache won&#8217;t allow mod_rewrite to forward the request.  Here is the relevant portion of proxy.conf (found in /etc/apache2/mods-enabled):</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60;Proxy *>
   Order deny,allow
   Deny from all
&#60;/Proxy>

&#60;Proxy http://xyz.com>
   Order deny,allow
   Deny from all
   Allow from all
&#60;/Proxy></pre>
</div>
<p></code></div>
</div>
<p>Now that you have the prerequisites ready, you can create the site definition on Server0 (/etc/apache2/sites-available/xyz.com):</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60;VirtualHost *>
   ServerName www.xyz.com
   # RewriteLog "/var/log/apache2/rewrite.log"
   # RewriteLogLevel 9
   RewriteEngine     On
   RewriteRule       ^(.*)$        http://xyz.com$1  [P]
   ServerAlias xyz.com
&#60;/VirtualHost></pre>
</div>
<p></code></div>
</div>
<p>Notice the rewrite rule, which will forward the request.  Since xyz.com (on server0) will now point to server1, you need to update your /etc/hosts file accordingly:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>192.168.2.10    xyz.com
192.168.2.10    www.xyz.com</pre>
</div>
<p></code></div>
</div>
<p>Now enable the the new site and restart Apache:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>a2ensite xyz.com
/etc/init.d/apache2 restart</pre>
</div>
<p></code></div>
</div>
<p>Now your done with Server0.  You&#8217;ll be glad to know there is nothing out of the ordinary for you to do on Server1.  All you have to do is create the site definition and enable (like you normally would).  So in /etc/apache2/sites-available create a site definition called xyz.com:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60;VirtualHost *>
   ServerName www.xyz.com
   DocumentRoot /var/www/xyz
   ServerAlias xyz.com
&#60;/VirtualHost></pre>
</div>
<p></code></div>
</div>
<p>Then enable the site, restart Apache and everything should work.  Odds have it something will go wrong and if it does, make sure to look in the Apache logs (/var/log/apache2/).  Also, enable the rewrite log (see above).  The logs will most likely always tell you exactly what went wrong.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2007/09/apache-forwarding-requests-to-another-server/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Friday wrap-up #3</title>
		<link>http://www.sematopia.com/2006/10/friday-wrap-up-3/</link>
		<comments>http://www.sematopia.com/2006/10/friday-wrap-up-3/#comments</comments>
		<pubDate>Sun, 29 Oct 2006 02:22:03 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Corporate]]></category>
		<category><![CDATA[Friday]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[iSeries]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=155</guid>
		<description><![CDATA[This was a busy week, a lot of catching up from all the time spent at CASCON last week. Continuing on from last week, I&#8217;ve gotten more intimate (?) with Dojo and its inner workings. I wrote about Dojo a couple months ago, and I&#8217;m still really impressed with everything going on there. A lot [...]]]></description>
			<content:encoded><![CDATA[<p>This was a busy week, a lot of catching up from all the time spent at CASCON last week.  Continuing on from last week, I&#8217;ve gotten more intimate (?) with Dojo and its inner workings.  I wrote about Dojo a couple months ago, and I&#8217;m still really impressed with everything going on there.  A lot of big name sites are built off this toolkit, including Meebo.</p>
<p>IBM results came out last week, the System i had a rough quarter, but IBM did well overall.  Last year at this time (3Q05) the System i had a break out quarter due to an upgrade cycle.  This  year (3Q06) there were no new upgrades and results were the same as 3Q04.  This <a href="http://www.systeminetwork.com/article/news/53420/index.html">article sums things up</a>:</p>
<blockquote><p>
IBM revenue for the System i fell 22 percent in the third quarter of 2006, or 23 percent at constant currency when compared to the same period of 2005. At the same time, nearly every other major IBM business unit saw revenue increase. Overall, earnings rose 47 percent compared to the previous year, up to $2.22 billion on revenues of $22.6 billion, which were up 5 percent.</p>
<p>The supply chain issues IBM faced in the second quarter of this year for System i sales, which were connected to a 7 percent drop in revenue for System i over the second quarter of 2005, have cleared up. IBM CFO Mark Loughridge noted that IBM&#8217;s supply chain did a superb job delivering System p, i, z, and storage but faltered over System x deliveries, contributing to the low rise of 4 percent for the System x. System p revenues increased 10 percent, and System z was a breakout star with a 25 percent increase in revenues while IBM delivered a 16 percent increase in System z MIPS (millions of instructions per second).</p>
<p>For the System i, IBM says 3Q06 compares to a particularly strong 3Q05 quarter, which was driven by upgrade activity from a fully refreshed roadmap, which in turn caused slowing revenue as customers leveraged those previous upgrades. Overall, IBM notes that System i revenue performance remains dependent upon cyclical upgrades.
</p></blockquote>
<p>I was at a Halloween fund raiser for Diabetes last night, it was a good time for a good cause.  I&#8217;m amazed that no matter what type of social event I may be at, there&#8217;s always someone thats directly involved with the System i in some way.</p>
<p>In other news, RedHat got murdered this week in the markets.  Cisco announced they would be creating a fork the RedHat&#8217;s version of Linux and providing half price support until the new year.  If any good can be seen out of this, it just re-affirms RedHat&#8217;s dominance in the Enterprise Linux market.</p>
<p>FireFox 2 came out this week, it generally seems more responsive, but definitely not as polished as it should be.  The memory leak issue doesn&#8217;t seem to have been fixed, since as I type FireFox is using upwards of 80mb memory and climbing.  The new spell checking feature is great though, any work misspelled get underlined in red, right click the and suggestions appear.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2006/10/friday-wrap-up-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How-To: Set up SVN with Apache2 in Linux (Ubuntu)</title>
		<link>http://www.sematopia.com/2006/03/how-to-set-up-svn-with-apache2-in-linux-ubuntu/</link>
		<comments>http://www.sematopia.com/2006/03/how-to-set-up-svn-with-apache2-in-linux-ubuntu/#comments</comments>
		<pubDate>Fri, 24 Mar 2006 07:21:14 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=66</guid>
		<description><![CDATA[Initially I didn&#8217;t plan on writing anything up about this, since its pretty basic to setup. But I ran into a slight problem, which I imagine others might run into also. I guess most would have Apache running already, so all that is needed is SVN: Code: > apt-get install subversion libapache2-svn Say you have [...]]]></description>
			<content:encoded><![CDATA[<p>Initially I didn&#8217;t plan on writing anything up about this, since its pretty basic to setup.  But I ran into a slight problem, which I imagine others might run into also.  I guess most would have Apache running already, so all that is needed is SVN:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>> apt-get install subversion libapache2-svn</pre>
</div>
<p></code></div>
</div>
<p>Say you have a domain already set up, call it abc.com.  You want to be able to checkout a repository from abc.com/svn.</p>
<p>Open the following file (/etc/apache2/mods-available/dav_svn.conf) in an editor and follow the instructions.  In the most basic form (with no authentication) you&#8217;ll have something like this when your done:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60; Location /abc.com/svn >
DAV svn
SVNPath /svn
&#60; /Location></pre>
</div>
<p></code></div>
</div>
<p>Inside the < Location /abc.com/svn > that path must point to a directory in your web server which does NOT exist.  abc.com will exist, but make sure svn doesn&#8217;t.  The SVNPath will point to the actual repository which MUST be outside your web server space.</p>
<p>This way, if you go to a browser and type: http://www.abc.com/svn nothing will show up, but when you checkout your repository, you will be re-directed to the actual svn directory (in this case /svn).</p>
<p>Now create the SVN repository, in directory /svn</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>> svnadmin create /svn</pre>
</div>
<p></code></div>
</div>
<p>Be sure to change the permissions on this directory, so the web server can write to the folder:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>> chown -R www-data /svn</pre>
</div>
<p></code></div>
</div>
<p>Restart Apache2:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>> /etc/init.d/apache2 -k restart</pre>
</div>
<p></code></div>
</div>
<p>Now from a remote computer, you should be able to type:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>svn co http://xxx.xxx.xxx.xx/abc.com/svn &#60; name ></pre>
</div>
<p></code></div>
</div>
<p>(were xxx.xxx.xxx.xxx is your server ip and name is what you want to call the local folder)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2006/03/how-to-set-up-svn-with-apache2-in-linux-ubuntu/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Using XML to store/send emails</title>
		<link>http://www.sematopia.com/2006/01/using-xml-to-storesend-emails/</link>
		<comments>http://www.sematopia.com/2006/01/using-xml-to-storesend-emails/#comments</comments>
		<pubDate>Fri, 27 Jan 2006 05:24:57 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=52</guid>
		<description><![CDATA[This has been a rough week, 4 assignments, an MIS, etc.  I made that phpPostFix script, its very simple, but I won't be able to use it.  My main server with GoDaddy is so terrible.  Its running an old version of PHP (4.2).  This version did not have file_get_contents as a function, so to make up for it, a while ago, I set up the PEAR Compat replacements.  To make a long story short, there are limitations in PHP 4.2 that for some reason, file_get_contents (the PEAR version used in PHP 4.2) can not accept URLs with more than 1 parameter.]]></description>
			<content:encoded><![CDATA[<p>This has been a rough week, 4 assignments, an MIS, etc.  I made that phpPostFix script, its very simple, but I won&#8217;t be able to use it.  My main server with GoDaddy is so terrible.  Its running an old version of PHP (4.2).  This version did not have file_get_contents as a function, so to make up for it, a while ago, I set up the PEAR Compat replacements.  To make a long story short, there are limitations in PHP 4.2 that for some reason, file_get_contents (the PEAR version used in PHP 4.2) can not accept URLs with more than 1 parameter.</p>
<p>I know what your thinking: &#8220;Just upgrade your version of PHP&#8221;.  You obviously have never used a GoDaddy product.  This is not an easy task, especially since their servers are married to Plesk and all the crap that come with it.  Above all that the main server is fully deployed, I can&#8217;t risk upgrading a shady setup.  Anyways, here <a href="http://www.sematopia.com/upload/phpPostFix/phpPostFix.tgz">is the script</a> that I wrote.  It does the job as explained in the previous post.  </p>
<p>Using the script is as easy as the following:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>$to = "someperson@yahoo.com";
$subject = "Test email";
$query_string = 'to='.urlencode($to).'&#038;subject='.urlencode($subject);
file_get_contents("http://www.someserver.com/phpPostFix.php?".htmlentities($query_string));</pre>
</div>
<p></code></div>
</div>
<p>I still need to be able to send email from development server.  So I spent some time thinking about it earlier this week.  I&#8217;m going to write the emails which need to be sent to an XML file (send.xml).  The schema will be as follows:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60;email>
&#60;to>&#60;/to>
&#60;cc>&#60;/cc>
&#60;bcc>&#60;/bcc>
&#60;subject>&#60;/subject>
&#60;body>&#60;/body>
&#60;/email></pre>
</div>
<p></code></div>
</div>
<p>Every 5 minutes the main server will read the XML file, parse it, and send the emails based on the results.  Once the emails are read, it will clear the original XML file (or append it to another backup.xml file).  At this point any new emails will be written to a fresh send.xml.  This method makes intuitive sense (sending in batch), especially since the development server could be sending hundreds of emails a day.  Lets hope this goes without a problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2006/01/using-xml-to-storesend-emails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My solution to port 25 being blocked</title>
		<link>http://www.sematopia.com/2006/01/my-solution-to-port-25-being-blocked/</link>
		<comments>http://www.sematopia.com/2006/01/my-solution-to-port-25-being-blocked/#comments</comments>
		<pubDate>Fri, 20 Jan 2006 04:58:46 +0000</pubDate>
		<dc:creator>George A. Papayiannis</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP/MySQL]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.sematopia.com/?p=51</guid>
		<description><![CDATA[So I've spent the last 2 days straight trying to get a full scale mail server running on my development Ubuntu server.  I had heard it wasn't going to be easy, but it needed to happen.  The plan was to go all out (Postfix + Courier IMAP  + Amavisd-new + SpamAssassin + ClamAV + SASL + TLS + SquirrelMail + Postgrey).  At around 7:00pm today, when I was completely defeated as to why it wasn't working it hit me: I bet my ISP has port 25 blocked.  A quick search on Google proved me right.]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve spent the last 2 days straight trying to get a full scale mail server running on my development Ubuntu server.  I had heard it wasn&#8217;t going to be easy, but it needed to happen.  The plan was to go all out (Postfix + Courier IMAP  + Amavisd-new + SpamAssassin + ClamAV + SASL + TLS + SquirrelMail + Postgrey).  At around 7:00pm today, when I was completely defeated as to why it wasn&#8217;t working it hit me: I bet my ISP has port 25 blocked.  A quick search on Google proved me right.</p>
<p>Depressed and annoyed I turned off my laptop, went to the library and then to the gym.  While reading Data Mining slides it hit me, I have my main dedicated server at GoDaddy (not to say they haven&#8217;t <a href="http://www.sematopia.com/?p=33">done me wrong</a> in the past).  I was considering using some relay host, but I thought of something better:  I&#8217;ll write a PHP script, which will reside on the main server, and will send mail the standard way (sendmail).  The PHP script (lets call it phpPostFix) will be accessed as a URL, and its parameters will be simply:<br />
- To:<br />
- From:<br />
- Subject:<br />
- Body:</p>
<p>On the development server any time I have:</p>
<div class='code_parent'>
<div class='code_title'>Code:</div>
<div class='code_child'><code>
<div class='pre_container'>
<pre>&#60;?php

file_get_contents("http://www.xxxxxx.com/phpPostFix.php?to=xxx@yy.com&#038;from=.....");

?></pre>
</div>
<p></code></div>
</div>
<p>Then the email will be sent.  Simple as that.  I&#8217;ll post the script when its done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sematopia.com/2006/01/my-solution-to-port-25-being-blocked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

