<?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>unexpected[it] &#187; Webserver</title>
	<atom:link href="http://www.unexpectedit.com/category/webserver/feed" rel="self" type="application/rss+xml" />
	<link>http://www.unexpectedit.com</link>
	<description>Professional IT Blog</description>
	<lastBuildDate>Tue, 31 Jan 2012 21:55:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Improving Spam Score on Ubuntu/Zend</title>
		<link>http://www.unexpectedit.com/webserver/improving-spam-score-on-ubuntu-zend</link>
		<comments>http://www.unexpectedit.com/webserver/improving-spam-score-on-ubuntu-zend#comments</comments>
		<pubDate>Sat, 28 Jan 2012 20:52:14 +0000</pubDate>
		<dc:creator>ipascual</dc:creator>
				<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=696</guid>
		<description><![CDATA[Domain: unexpectedit.com Static IP (or Elastic Amazon IP): 107.123.23.123 Setting up Postfix Setting up rDNS on Amazon Go to https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request Elastic IP Address 1: 107.123.23.123 Reverse DNS Record for EIP 1: mail1.unexpectedit.com Setting up SPF Records Add to your domain TXT pointing to @ v=spf1 a ip4:107.123.23.123 include:aspmx.googlemail.com ~all &#8230;where 107.123.23.123 is your Apache/PHP server [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Domain: </strong>unexpectedit.com<br />
<strong>Static IP (or Elastic Amazon IP): </strong>107.123.23.123</p>
<h2>Setting up Postfix</h2>
<pre class="brush: bash; title: ; notranslate">
dpkg-reconfigure postfix
# Internet Site
# unexpectedit.com
</pre>
<h2>Setting up rDNS on Amazon</h2>
<p>Go to https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request<br />
Elastic IP Address 1: 107.123.23.123<br />
Reverse DNS Record for EIP 1: mail1.unexpectedit.com</p>
<h2>Setting up SPF Records</h2>
<p>Add to your domain TXT pointing to @<br />
<strong>v=spf1 a ip4:107.123.23.123 include:aspmx.googlemail.com ~all </strong><br />
&#8230;where 107.123.23.123 is your Apache/PHP server IP and we relay the mailboxes to Google Apps.</p>
<h2>Check headers when I receive email</h2>
<p>On a Brinkster (www.brinkster.com) mailbox</p>
<pre>
Return-Path: www-data@unexpectedit.com
X-DSPAM-Result: Innocent
X-DSPAM-Class: Innocent
X-DSPAM-Confidence: 0.79
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: N/A
X-Virus-Scanned: amavisd-new at mta2.brinkster.com
X-Spam-Flag: NO
<strong>X-Spam-Score: 2.399</strong>
X-Spam-Level: **
X-Spam-Status: No, score=2.399 tagged_above=-10 required=5
	tests=[BAYES_50=0.001, FH_HELO_EQ_D_D_D_D=0.001,
	HTML_IMAGE_ONLY_20=1.546, HTML_MESSAGE=0.001,
	HTML_SHORT_LINK_IMG_3=0.001, MPART_ALT_DIFF=0.739,
	MPART_ALT_DIFF_COUNT=1.11, DSPAM:Innocent=-1.000] autolearn=no
Received: from mta2.brinkster.com ([127.0.0.1])
	by localhost (mta2.brinkster.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id YwUJP968VFhq for <other.user@unexpectedit.com>;
	Thu, 26 Jan 2012 05:40:02 -0500 (EST)
Received: from ip-10-190-222-218.ec2.internal (mail1.snappygo.com [107.123.23.123])
	by mta2.brinkster.com (Postfix) with ESMTP id 360B31285D4
	for <other.user@unexpectedit.com>; Thu, 26 Jan 2012 05:40:02 -0500 (EST)
Received: by ip-10-190-222-218.ec2.internal (Postfix, from userid 33)
	id 93D7C43AB5; Thu, 26 Jan 2012 10:39:20 +0000 (UTC)
</pre>
<p>On a Google mailbox </p>
<pre>
Received-SPF: pass (google.com: domain of www-data@unexpectedit.com designates 107.123.23.123 as permitted sender) client-ip=107.123.23.123;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of www-data@unexpectedit.com designates 107.123.23.123 as permitted sender) smtp.mail=www-data@unexpectedit.com
</pre>
<h2>Improve postfix settings</h2>
<p><strong>vi /etc/postfix/main.cf</strong></p>
<pre class="brush: bash; title: ; notranslate">
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate &quot;delayed mail&quot; warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname = unexpectedit.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = unexpectedit.com, localhost.ec2.internal, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
</pre>
<p><strong>vi /etc/mailname </strong></p>
<pre class="brush: bash; title: ; notranslate">
mail1.unexpectedit.com
</pre>
<h2>Change the Return-Path header of email to an existing account</h2>
<pre class="brush: php; title: ; notranslate">
//Setting Return-Path header
$tr = new Zend_Mail_Transport_Sendmail('-finfo@unexpectedit.com');
Zend_Mail::setDefaultTransport($tr);

//Create Mail on Zend_Mail
$mail = new Zend_Mail();
$mail-&gt;setFrom(&quot;info@unexpectedit.com&quot;, &quot;Unexpected It&quot;);
$mail-&gt;addTo(&quot;other.user@unexpectedit.com&quot;);
$mail-&gt;setSubject($subject);
$mail-&gt;setBodyText($text);
$mail-&gt;setBodyHtml($html);
$mail-&gt;send();
</pre>
<h2>Check headers now</h2>
<pre>
Return-Path: info@unexpectedit.com
X-DSPAM-Result: Innocent
X-DSPAM-Class: Innocent
X-DSPAM-Confidence: 0.69
X-DSPAM-Probability: 0.0000
X-DSPAM-Signature: N/A
X-Virus-Scanned: amavisd-new at mta9.brinkster.com
X-Spam-Flag: NO
<strong>X-Spam-Score: -1.822</strong>
X-Spam-Level:
X-Spam-Status: No, score=-1.822 tagged_above=-10 required=5
	tests=[BAYES_00=-2.599, HTML_IMAGE_ONLY_32=1.778, HTML_MESSAGE=0.001,
	SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, DSPAM:Innocent=-1.000]
	autolearn=no
Received: from mta9.brinkster.com ([127.0.0.1])
	by localhost (mta9.brinkster.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id g7xih7MpqhwG for <other-user@unexpectedit.com>;
	Sat, 28 Jan 2012 15:06:09 -0500 (EST)
Received: from unexpectedit.com (mail1.unexpectedit.com [107.123.23.123])
	by mta9.brinkster.com (Postfix) with ESMTP id 0478E49329B
	for <other.user@unexpectedit.com>; Sat, 28 Jan 2012 15:06:06 -0500 (EST)
Received: by snappygo.com (Postfix, from userid 33)
	id B516D441A8; Sat, 28 Jan 2012 20:05:32 +0000 (UTC)
</pre>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/improving-spam-score-on-ubuntu-zend/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SUID to Linux bash or sh scripts</title>
		<link>http://www.unexpectedit.com/webserver/suid-to-linux-bash-or-sh-scripts</link>
		<comments>http://www.unexpectedit.com/webserver/suid-to-linux-bash-or-sh-scripts#comments</comments>
		<pubDate>Thu, 21 Jul 2011 15:46:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>
		<category><![CDATA[password sudo]]></category>
		<category><![CDATA[sudo root]]></category>
		<category><![CDATA[sudo script]]></category>
		<category><![CDATA[suid]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=648</guid>
		<description><![CDATA[Running scripts / programs as root privileges. Assign SUID to programs I doesn&#8217;t work with shell scripts!!! Linux doesn&#8217;t allow you to use SUID root for shell scripts due to security role. Just real binary programs. The reason is because an attacker could get the computer to execute any shell script when the script is [...]]]></description>
			<content:encoded><![CDATA[<h2>Running scripts / programs as root privileges.</h2>
<h3>Assign SUID to programs</h3>
<pre class="brush: bash; title: ; notranslate">
$ chmod 4755 /home/ipascual/scripts/test.sh
</pre>
<p><strong>I doesn&#8217;t work with shell scripts!!!</strong></p>
<p>Linux doesn&#8217;t allow you to use SUID root for shell scripts due to security role. Just real binary programs.<br />
The reason is because an attacker could get the computer to execute any shell script when the script is processing to execute. Because of this, modern linux distributions ignore SUID shell scripts.</p>
<p><strong>The solution is to use &#8220;sudo&#8221;.</strong></p>
<h3>What is sudo?</h3>
<p>sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file.<br />
But, sudo asks me for the root! My users still can&#8217;t use it whiout password.</p>
<h3>Running a shell script without asking for root password</h3>
<pre class="brush: bash; title: ; notranslate">
$ sudo visudo

# Add this line at the end
ipascual        ALL=NOPASSWD: /home/ipascual/scripts/test.sh

$ cat /home/ipascual/scripts/test.sh
#!/bin/sh
/sbin/shutdown -h now

$ sudo /home/ipascual/scripts/test.sh
</pre>
<p>Now the user <strong>ipascual</strong> will execute <strong>test.sh</strong> as root without password.</p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/suid-to-linux-bash-or-sh-scripts/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Other useful script to avoid upload phpMyAdmin</title>
		<link>http://www.unexpectedit.com/webserver/other-useful-script-to-avoid-upload-phpmyadmin</link>
		<comments>http://www.unexpectedit.com/webserver/other-useful-script-to-avoid-upload-phpmyadmin#comments</comments>
		<pubDate>Fri, 15 Jul 2011 00:57:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>
		<category><![CDATA[mysql_import]]></category>
		<category><![CDATA[php import mysql dump script]]></category>
		<category><![CDATA[php run query script]]></category>
		<category><![CDATA[php script mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=644</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">

import_tables('localhost','root','123456','blogdb','database-dump.sql');

show_tables('localhost','root','123456','blogdb');

run_query('localhost','root','123456','blogdb', 'select * from wp_users');

show_variables('localhost','root','123456');

function import_tables($host,$user,$pass,$db,$file)
{
	passthru(&quot;nohup mysql -h'&quot;.$host.&quot;' -u'&quot;.$user.&quot;' -p'&quot;.$pass.&quot;' &quot;.$db.&quot; &lt; &quot;.$file);
}

function show_tables($host,$user,$pass,$db)
{
    $link = mysql_connect($host,$user,$pass);
    mysql_select_db($db,$link);

	$tables = array();
	$result = mysql_query('SHOW TABLES');

	while($row = mysql_fetch_row($result))
	{
		echo $row[0] . &quot;&lt;br/&gt;&quot;;
	}
}

function run_query($host,$user,$pass,$db,$sql)
{
    $link = mysql_connect($host,$user,$pass);
    mysql_select_db($db,$link);

	$tables = array();
	$result = mysql_query($sql);

	while($row = mysql_fetch_row($result))
	{
		foreach($row as $field) {
			echo $field. &quot; &quot;;
		}
		echo &quot;&lt;br/&gt;&quot;;
	}
}

function show_variables($host,$user,$pass)
{
    $link = mysql_connect($host,$user,$pass);

    $tables = array();
    $result = mysql_query('SHOW VARIABLES');

    while($row = mysql_fetch_row($result))
    {
		echo $row[0].' : '.$row[1].&quot;&lt;br&gt;\n&quot;;
    }
}
</pre>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/other-useful-script-to-avoid-upload-phpmyadmin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Website full php backup script, mysql / files</title>
		<link>http://www.unexpectedit.com/webserver/website-full-php-backup-script-mysql-files</link>
		<comments>http://www.unexpectedit.com/webserver/website-full-php-backup-script-mysql-files#comments</comments>
		<pubDate>Thu, 14 Jul 2011 00:20:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>
		<category><![CDATA[backup database]]></category>
		<category><![CDATA[backup files]]></category>
		<category><![CDATA[database mysql]]></category>
		<category><![CDATA[webserver]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=634</guid>
		<description><![CDATA[Hi, it&#8217;s being lot of times to download an old website from other company to start working on it, or just to have a copy in localhost to work with. I had to create a script to make my job easier. Thanks to David Walsh for backup_tables cool function I can share this script to [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, it&#8217;s being lot of times to download an old website from other company to start working on it, or just to have a copy in localhost to work with.</p>
<p>I had to create a script to make my job easier. </p>
<p>Thanks to David Walsh for backup_tables cool function I can share this script to you guys</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
//1) Create a database dump file
backup_tables('localhost','root','123456','database_blog');

//2 Compress all folder tree including the database dump file before
$target = dirname(__FILE__);
echo exec('tar cfvz backup-'.time().'.tar.gz '.$target);

//3 To upload the full website
$target = dirname(__FILE__).&quot;/website.zip&quot;;
echo exec('unzip '.$target);

/*
*	Script from http://davidwalsh.name/backup-mysql-database-php
* Thanks to david walsh
*/
function backup_tables($host,$user,$pass,$name,$tables = '*')
{

	$link = mysql_connect($host,$user,$pass);
	mysql_select_db($name,$link);

	//get all of the tables
	if($tables == '*')
	{
		$tables = array();
		$result = mysql_query('SHOW TABLES');
		while($row = mysql_fetch_row($result))
		{
			$tables[] = $row[0];
		}
	}
	else
	{
		$tables = is_array($tables) ? $tables : explode(',',$tables);
	}

	//cycle through
	foreach($tables as $table)
	{
		$result = mysql_query('SELECT * FROM '.$table);
		$num_fields = mysql_num_fields($result);

		$return.= 'DROP TABLE '.$table.';';
		$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
		$return.= &quot;\n\n&quot;.$row2[1].&quot;;\n\n&quot;;

		for ($i = 0; $i &lt; $num_fields; $i++)
		{
			while($row = mysql_fetch_row($result))
			{
				$return.= 'INSERT INTO '.$table.' VALUES(';
				for($j=0; $j&lt;$num_fields; $j++)
				{
					$row[$j] = addslashes($row[$j]);
					$row[$j] = ereg_replace(&quot;\n&quot;,&quot;\\n&quot;,$row[$j]);
					if (isset($row[$j])) { $return.= '&quot;'.$row[$j].'&quot;' ; } else { $return.= '&quot;&quot;'; }
					if ($j&lt;($num_fields-1)) { $return.= ','; }
				}
				$return.= &quot;);\n&quot;;
			}
		}
		$return.=&quot;\n\n\n&quot;;
	}

	//save file
	$handle = fopen('db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
	fwrite($handle,$return);
	fclose($handle);
}

?&gt;
</pre>
<p>References: http://davidwalsh.name/backup-mysql-database-php</p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/website-full-php-backup-script-mysql-files/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon EC2 Multiples SSL Certificates</title>
		<link>http://www.unexpectedit.com/webserver/amazon-ec2-multiples-ssl-certificates</link>
		<comments>http://www.unexpectedit.com/webserver/amazon-ec2-multiples-ssl-certificates#comments</comments>
		<pubDate>Sun, 03 Apr 2011 05:05:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=481</guid>
		<description><![CDATA[1) Install Java-Ibm 2) Install ElasticLoadBalancing-1.0 3) Generate Security Credentials Amazon > Account > Security Credentials X.509 Credentials Create &#8220;Download Private Key File&#8221; and rename it to PrivateKey.pem &#8220;Download X.509 certificate&#8221; and rename it to ServerCertificate.pem Upload both files to /mnt 4) Download ElasticLoadBalancing-1.0.10.0.zip or the lastest version and install it under /root/bin/elb 5) Unix [...]]]></description>
			<content:encoded><![CDATA[<p>1) Install Java-Ibm</p>
<p>2) Install ElasticLoadBalancing-1.0</p>
<p>3) Generate Security Credentials<br />
Amazon > Account > Security Credentials<br />
X.509 Credentials<br />
Create<br />
&#8220;Download Private Key File&#8221; and rename it to PrivateKey.pem<br />
&#8220;Download X.509 certificate&#8221; and rename it to ServerCertificate.pem</p>
<p>Upload both files to /mnt</p>
<p>4) Download ElasticLoadBalancing-1.0.10.0.zip or the lastest version and install it under /root/bin/elb</p>
<p>5) Unix shell make variables</p>
<pre class="brush: bash; title: ; notranslate">
export AWS_ELB_HOME=/root/bin/elb
export JAVA_HOME=/usr/lib/jvm/java-1_6_0-ibm-1.6.0/jre
export PATH=$PATH:/root/bin/elb/bin
export EC2_PRIVATE_KEY=/mnt/PrivateKey.pem
export EC2_CERT=/mnt/ServerCertificate.pem
</pre>
<p>6) Config ELB<br />
# elb-create-lb onlinecommunityspecialists &#8211;headers &#8211;listener &#8220;lb-port=443,instance-port=8443,protocol=TCP&#8221; &#8211;listener &#8220;lb-port=80,instance-port=80,protocol=http&#8221; &#8211;region eu-west-1 &#8211;availability-zones eu-west-1a<br />
DNS_NAME  DNS_NAME<br />
DNS_NAME  onlinecommunityspecialists-1752118929.eu-west-1.elb.amazonaws.com</p>
<p># elb-create-lb neverforget                &#8211;headers &#8211;listener &#8220;lb-port=443,instance-port=8444,protocol=TCP&#8221; &#8211;listener &#8220;lb-port=80,instance-port=80,protocol=http&#8221; &#8211;region eu-west-1 &#8211;availability-zones eu-west-1a<br />
DNS_NAME  DNS_NAME<br />
DNS_NAME  neverforget-1687287348.eu-west-1.elb.amazonaws.com</p>
<p># elb-register-instances-with-lb onlinecommunityspecialists &#8211;region eu-west-1 &#8211;instances i-9d84dcea</p>
<p># elb-register-instances-with-lb neverforget &#8211;region eu-west-1 &#8211;instances i-9d84dcea</p>
<p>7) Config Apache to listen to that ports with different SSL</p>
<pre class="brush: bash; title: ; notranslate">
# vi /etc/apache2/listen.conf
Listen 80
Listen 8443
Listen 8444
NameVirtualHost *:80
NameVirtualHost *:8443
NameVirtualHost *:8444

# vi /etc/apache2/vhosts.d/vhost.conf
&lt;VirtualHost *:80&gt;
    ServerAdmin root@linux.com
    DocumentRoot /srv/www/htdocs/online
    ServerName www.onlinecommunityspecialists.co.uk
    ServerAlias www.onlinecommunityspecialists.co.uk
    HostnameLookups Off
    ServerSignature On
    &lt;Directory &quot;/srv/www/htdocs/online&quot;&gt;
        Options -Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;VirtualHost *:80&gt;
    ServerAdmin root@linux.com
    DocumentRoot /srv/www/htdocs/neverforget
    ServerName www.neverforgetagain.co.uk
    ServerAlias www.neverforgetagain.co.uk
    HostnameLookups Off
    ServerSignature On
    &lt;Directory &quot;/srv/www/htdocs/neverforget&quot;&gt;
        Options -Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;IfDefine SSL&gt;
&lt;IfDefine !NOSSL&gt;

&lt;VirtualHost *:8444&gt;
    ServerAdmin ipascual@unexpectedit.com
    DocumentRoot /srv/www/htdocs/neverforget
    ServerName www.neverforgetagain.co.uk
    ServerAlias www.neverforgetagain.co.uk

    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/apache2/ssl.crt/www_neverforgetagain_co_uk.crt
    SSLCertificateKeyFile /etc/apache2/ssl.crt/neverforgetagain.key
    SSLCertificateChainFile /etc/apache2/ssl.crt/www_neverforgetagain_co_uk.ca-bundle
    SetEnvIf User-Agent &quot;.*MSIE.*&quot; nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

    &lt;Directory &quot;/srv/www/htdocs/neverforget&quot;&gt;
        Options -Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;VirtualHost *:8443&gt;
    ServerAdmin ipascual@unexpectedit.com
    DocumentRoot /srv/www/htdocs/online
    ServerName www.onlinecommunityspecialists.co.uk
    ServerAlias www.onlinecommunityspecialists.co.uk

    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/apache2/ssl.crt/www_onlinecommunityspecialists_co_uk.crt
    SSLCertificateKeyFile /etc/apache2/ssl.crt/onlinecomunityspecialists.key
    SSLCertificateChainFile /etc/apache2/ssl.crt/www_onlinecommunityspecialists_co_uk.ca-bundle
    SetEnvIf User-Agent &quot;.*MSIE.*&quot; nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

    &lt;Directory &quot;/srv/www/htdocs/online&quot;&gt;
        Options -Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;
&lt;/IfDefine&gt;
&lt;/IfDefine&gt;
</pre>
<p>7) Add CNAME records to your domains<br />
Domain: onlinecommunityspecialists.co.uk<br />
www  >>> onlinecommunityspecialists-1752118929.eu-west-1.elb.amazonaws.com.<br />
Domain: neverforgetagain.co.uk<br />
www >>> neverforget-1687287348.eu-west-1.elb.amazonaws.com</p>
<p>8) Do not forget to open the ports related on your Amazon Firewall</p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/amazon-ec2-multiples-ssl-certificates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion SVN and Magento</title>
		<link>http://www.unexpectedit.com/webserver/subversion-svn-and-magento</link>
		<comments>http://www.unexpectedit.com/webserver/subversion-svn-and-magento#comments</comments>
		<pubDate>Sun, 03 Apr 2011 05:02:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=476</guid>
		<description><![CDATA[These are the steps that I&#8217;ve followed to have a SVN Server for a company running Magento with modules and several developers. 1) Create the default structure /root/my_project . &#124;-branches &#124;&#8212;stable (production stable versions) &#124;&#8212;vendors &#124;&#8212;&#8211;x (release versions from Magento) &#124;-tags &#124;-trunk &#124;&#8212;data (database backups) &#124;&#8212;scripts (shell scripts) &#124;&#8212;src (last version of your development magento [...]]]></description>
			<content:encoded><![CDATA[<p>These are the steps that I&#8217;ve followed to have a SVN Server for a company running Magento with modules and several developers.</p>
<p><strong>1) Create the default structure</strong></p>
<p>/root/my_project<br />
   .<br />
   |-branches<br />
   |&#8212;stable		(production stable versions)<br />
   |&#8212;vendors<br />
   |&#8212;&#8211;x			(release versions from Magento)<br />
   |-tags<br />
   |-trunk<br />
   |&#8212;data			(database backups)<br />
   |&#8212;scripts		(shell scripts)<br />
   |&#8212;src			(last version of your development magento site)</p>
<p><strong>2) Copy your initial Magento version.</strong> Delete and create templates (or use SVN ignore/lock instead for this)</p>
<pre class="brush: bash; title: ; notranslate">
# cp -R /srv/www/htdocs/Handpicked /root/my_project/trunk/src/
app/etc/local.xml (*local.sample.xml)
media/
var/
36093_nmerchandis.txt
.project
.server-monitor/config.php (*config.sample.xml)
.server-monitor/phpMyAdmin/config.inc.php (*config.sample.inc.xml)
(*template config files)
</pre>
<p><strong>3) Copy your Magento original version under </strong><br />
/root/my_project/branches/stable/1.4.0.1/</p>
<p><strong>4) Create repository</strong></p>
<pre class="brush: bash; title: ; notranslate">
# svnadmin create /srv/svn/handpicked
# chown -R wwwrun:www /srv/svn
# /etc/init.d/svnserve start
# /etc/init.d/apache2 restart
</pre>
<p><strong>5) Add the first version of your project</strong></p>
<pre class="brush: bash; title: ; notranslate">
# cd /root/my_project
# svn import . http://ec2-xx-xx-xx-amazon.com/svn/repo/ -m &quot;Initial version&quot;
</pre>
<p><strong>6) Merge Production image folder wih Test image folder script</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh
rm -rf /srv/www/htdocs/Handpicked/media/catalog/product/cache
rsync -e &quot;ssh -i /root/.ssh/handpickedserver.pem -c blowfish -l root&quot; -avx --delete-excluded --recursive --exclude '*media/catalog/product/cache*' root@www.handpickedcollection.com:/srv/www/htdocs/Handpicked/media /srv/www/htdocs/Handpicked/
</pre>
<p>/root/my_project<br />
   .<br />
   |-branches<br />
   |&#8212;stable		(production stable versions)<br />
   |&#8212;&#8211;1.4.0.1.handpicked23<br />
   |&#8212;&#8212;-data<br />
   |&#8212;&#8212;&#8212;HandpickedMagento.sql.gz<br />
   |&#8212;&#8212;-scripts<br />
   |&#8212;&#8212;-data<br />
   |&#8212;&#8212;&#8212;[...]<br />
   |&#8212;vendors<br />
   |&#8212;&#8211;magento	(release versions from Magento)<br />
   |&#8212;&#8212;-1.4.0.1<br />
   |&#8212;&#8212;&#8212;[...]<br />
   |-tags<br />
   |-trunk<br />
   |&#8212;data			(database backups)<br />
   |&#8212;scripts		(shell scripts)<br />
   |&#8212;src			(last version of your development magento site)<br />
   |&#8212;&#8211;[...]</p>
<p>Errors:<br />
svn: Can&#8217;t open file &#8216;&#8230;file.txt&#8217;: No such file or directory<br />
This is a case sensivity issue. Please remove from console the file with &#8220;svn del&#8221; and &#8220;svn commit&#8221; before checkout again.</p>
<p>&#8230; Could not read chunk size: connection was closed by server &#8230;<br />
This is a timeout issue. Change in /etc/apache2/server-tuning.conf<br />
KeepAliveTimeout 15<br />
TO<br />
KeepAliveTimeout 360</p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/subversion-svn-and-magento/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a SVN server on Amazon EC2</title>
		<link>http://www.unexpectedit.com/webserver/creating-a-svn-server-on-amazon-ec2</link>
		<comments>http://www.unexpectedit.com/webserver/creating-a-svn-server-on-amazon-ec2#comments</comments>
		<pubDate>Sun, 03 Apr 2011 04:59:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=472</guid>
		<description><![CDATA[These settings are for a Suse Linux SP1 with Apache 2 server running ip-10-48-162-89:~ # vi /etc/sysconfig/apache2 APACHE_MODULES=&#8221;&#8230; mod_dav mod_dav_svn mod_authz_svn&#8221; ip-10-48-162-89:~ # vi /etc/apache/httpd.conf ip-10-48-162-89:~ # vi /etc/svn-auth-users ip-10-48-162-89:~ # htpasswd -cm /etc/svn-auth-passwd ignacio (Execute this command for each user, remove -c to avoid overwrite the file) ip-10-48-162-89:~ # vi /etc/sysconfig/svnserve SVNSERVE_OPTIONS=&#8221;-d -R -r [...]]]></description>
			<content:encoded><![CDATA[<h2>These settings are for a Suse Linux SP1 with Apache 2 server running</h2>
<p><strong>ip-10-48-162-89:~ # vi /etc/sysconfig/apache2</strong><br />
APACHE_MODULES=&#8221;&#8230; mod_dav mod_dav_svn mod_authz_svn&#8221;</p>
<p><strong>ip-10-48-162-89:~ # vi /etc/apache/httpd.conf</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;Location /svn&gt;
	DAV svn
	SVNParentPath /srv/svn

	# how to authenticate a user
	AuthType Basic
	AuthName &quot;Subversion repository&quot;
	AuthzSVNAccessFile /etc/svn-auth-users
        AuthUserFile /etc/svn-auth-passwd
 	Require valid-user
&lt;/Location&gt;
</pre>
<p><strong>ip-10-48-162-89:~ # vi /etc/svn-auth-users</strong></p>
<pre class="brush: xml; title: ; notranslate">
[/]
guest = r
admin = rw
ignacio = rw
</pre>
<p><strong>ip-10-48-162-89:~ # htpasswd -cm /etc/svn-auth-passwd ignacio</strong></p>
<pre class="brush: bash; title: ; notranslate">
New password:
Re-type new password:
Adding password for user ignacio
</pre>
<p>(Execute this command for each user, remove -c to avoid overwrite the file)</p>
<p><strong>ip-10-48-162-89:~ # vi /etc/sysconfig/svnserve </strong><br />
SVNSERVE_OPTIONS=&#8221;-d -R -r /srv/svn&#8221;<br />
SVNSERVE_USERID=&#8221;svn&#8221;<br />
SVNSERVE_GROUPID=&#8221;svn&#8221;</p>
<p><strong>Creating repository folder and unix user/group</strong><br />
ip-10-48-162-89:~ # mkdir /srv/svn<br />
ip-10-48-162-89:~ # useradd svn<br />
ip-10-48-162-89:~ # groupadd svn </p>
<p><strong>Create a repository (use &#8220;repo&#8221; as the name of your company)</strong><br />
ip-10-48-162-89:~ # svnadmin create /srv/svn/repo<br />
ip-10-48-162-89:~ # chown -R wwwrun:www /srv/svn<br />
ip-10-48-162-89:~ # /etc/init.d/svnserve start<br />
ip-10-48-162-89:~ # /etc/init.d/apache2 restart<br />
ip-10-48-162-89:~ # cd ~<br />
ip-10-48-162-89:~ # mkdir my_project<br />
ip-10-48-162-89:~ # cd my_project/<br />
ip-10-48-162-89:~/my_project # mkdir branches  tags  trunk<br />
ip-10-48-162-89:~/my_project # cd trunk</p>
<p><strong>Import all the files to your repository</strong><br />
ip-10-48-162-89:~/# cd ..<br />
ip-10-48-162-89:~/# svn import . http://ec2-xx-xx-xx-amazon.com/svn/repo/ -m &#8220;Initial version&#8221;</p>
<p><a href="http://www.unexpectedit.com/wp-content/uploads/2011/04/svn1.jpg"><img src="http://www.unexpectedit.com/wp-content/uploads/2011/04/svn1-300x216.jpg" alt="" title="svn1" width="300" height="216" class="aligncenter size-medium wp-image-473" /></a></p>
<p><br/><br />
<a href="http://www.unexpectedit.com/wp-content/uploads/2011/04/svn2.jpg"><img src="http://www.unexpectedit.com/wp-content/uploads/2011/04/svn2.jpg" alt="" title="svn2" width="468" height="156" class="aligncenter size-full wp-image-474" /></a></p>
<p><strong>Fist time you want to use the trunk version to your web server</strong><br />
cd /srv/www/htdocs<br />
svn checkout http://ec2-xx-xx-xx-amazon.com/svn/repo/trunk .</p>
<p><strong>Next times</strong><br />
cd /srv/www/htdocs<br />
svn update</p>
<p><strong>Notes</strong><br />
If you get &#8220;mod_security: Access denied with code 403.&#8221;<br />
Add these lines to disable mod_security on /etc/apache/httpd.conf<br />
<IfModule mod_security.c><br />
    # Turn off mod_security filtering.<br />
    SecFilterEngine Off</p>
<p>    # The below probably isn&#8217;t needed, but better safe than sorry.<br />
    SecFilterScanPOST Off<br />
</IfModule></p>
<p><strong>Note: Replace ec2-xx-xx-xx-amazon.com for your instance e.g.ec2-46-23-152-198.eu-west-1.compute.amazonaws.com</strong></p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/creating-a-svn-server-on-amazon-ec2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon EC2 SUSE Linux Enterprise Server for Magento</title>
		<link>http://www.unexpectedit.com/webserver/amazon-ec2-suse-linux-enterprise-server-for-magento</link>
		<comments>http://www.unexpectedit.com/webserver/amazon-ec2-suse-linux-enterprise-server-for-magento#comments</comments>
		<pubDate>Sun, 03 Apr 2011 04:54:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=470</guid>
		<description><![CDATA[These are the steps that I&#8217;ve followed to create an instance of Suse Linux Enterprise for a Magento store on Amazon EC2 EC2 SUSE Linux Enterprise Server 11 32-bit SP1 - MySQL 5.0.67 - Apache 2.2.16 - OpenSSL 0.9.8h - PHP 5.3.3 Getting ready to run Magento 1.4 with two websites and multiple stores. domain [...]]]></description>
			<content:encoded><![CDATA[<p>These are the steps that I&#8217;ve followed to create an instance of Suse Linux Enterprise for a Magento store on Amazon EC2</p>
<p>EC2 SUSE Linux Enterprise Server 11 32-bit SP1<br />
- MySQL 5.0.67<br />
- Apache 2.2.16<br />
- OpenSSL 0.9.8h<br />
- PHP 5.3.3</p>
<p>Getting ready to run Magento 1.4 with two websites and multiple stores.<br />
domain a > magento website1 / store1<br />
domain b > magento website1 / store2<br />
domain c > magento website2 / store3</p>
<p>1) Add the next repositories in YaST > Software > Software Repositories<br />
** Apparently openSUSE_11.1 is not available any more. Try with openSUSE_11.3 repository instead **<br />
	a) Apache &#8211; http://download.opensuse.org/repositories/Apache/openSUSE_11.3/<br />
	b) Apache Modules &#8211; http://download.opensuse.org/repositories/Apache:/Modules/Apache_openSUSE_11.3/<br />
	c) Apache PHP Modules &#8211; http://download.opensuse.org/repositories/server:/php/openSUSE_11.3/<br />
	(Thanks to Opensuse.org! http://en.opensuse.org/Additional_package_repositories)<br />
(image1)</p>
<p>2) Install the next packages from YaST > Software > Software Management<br />
Packages installed:<br />
php5<br />
php5-bz2<br />
php5-calendar<br />
php5-ctype<br />
php5-curl<br />
php5-devel<br />
php5-dom<br />
php5-exif<br />
php5-fileinfo<br />
php5-ftp<br />
php5-gd<br />
php5-gettext<br />
php5-gmp<br />
php5-hash<br />
php5-iconv<br />
php5-json<br />
php5-ldap<br />
php5-mbstring<br />
php-mcrypt<br />
php5-mysql<br />
php5-openssl<br />
php5-pdo<br />
php5-pear<br />
php5-phar<br />
php5-shmop<br />
php5-soap<br />
php5-sockets<br />
php5-sqlite<br />
php5-tokenizer<br />
php5-wddx<br />
php5-xmlreader<br />
php5-xmlrpc<br />
php5-xmlwriter<br />
php5-xsl<br />
php5-zip<br />
php5-zlib</p>
<p>apache2<br />
apache-devel<br />
apache2-prefork<br />
apache2-utils<br />
apache2-mod_php5<br />
apache2-mod_security<br />
apache2-mod_stats<br />
apache2-mod_telemetry</p>
<p>mysql<br />
mysql-client</p>
<p>logwatch</p>
<p>3) Setting up mod_security<br />
# mkdir /srv/www/logs</p>
<p>4) Setting up Apache, Mysql and PHP5<br />
<a href...">Apache2_PHP5_Standard_Config.zip</a></p>
<p># vi /etc/sysconfig/apache2<br />
[...]<br />
APACHE_MODULES=&#8221;actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir php5 rewrite status security deflate&#8221;<br />
# If you need SSL activate this flag<br />
APACHE_SERVER_FLAGS=&#8221;-D SSL&#8221;<br />
[...]</p>
<p># vi /etc/php5/apache2/php.ini<br />
[...]<br />
short_open_tag = On<br />
[...]<br />
date.timezone = &#8220;Europe/London&#8221;<br />
date.timezone = &#8220;America/Bogota&#8221;<br />
[...]</p>
<p>3) Install PHP APC Cache<br />
pecl install channel://pecl.php.net/apc-3.1.4</p>
<p>4) Extra Software Needed (if needed)<br />
# YaST<br />
lynx<br />
vsftpd</p>
<p>#vi /etc/vsftpd.conf<br />
anonymous_enable=NO<br />
# Amazon Firewall Ports Open<br />
pasv_max_port=30000<br />
pasv_min_port=30100<br />
pam_service_name=vsftpd<br />
#userlist_enable=YES<br />
tcp_wrappers=NO<br />
pasv_enable=YES<br />
port_enable=YES<br />
# Log everything<br />
log_ftp_protocol=NO<br />
# Block the users to Home Folder<br />
chroot_local_user=YES</p>
<p>5) Date and Time<br />
YaST > System > Date and Time</p>
<p>6) Automatic Startup Services<br />
# chmod 755 /etc/init.d/mysql<br />
# chkconfig &#8211;add mysql<br />
# chkconfig &#8211;level 35 mysql on </p>
<p># chmod 755 /etc/init.d/apache2<br />
# chkconfig &#8211;add apache2<br />
# chkconfig &#8211;level 35 apache2 on </p>
<p>At this point is the AMI Image &#8220;Suse11S1 v2 UnexpectedIT&#8221;<br />
Apache 2.2.16<br />
PHP Version 5.3.4-dev<br />
APC 3.1.4<br />
MySQL 5.0.67</p>
<p># mysql_secure_installation</p>
<p># vi /etc/aliases<br />
[...]<br />
root:	handpicked@richardmason.net<br />
[...]</p>
<p># vi /etc/postfix/main.cf<br />
myhostname = ec2-12-34-567-89.eu-west-1.compute.amazonaws.com<br />
smtp_generic_maps = hash:/etc/postfix/generic</p>
<p># vi /etc/postfix/generic<br />
wwwrun@ec2-12-34-567-89.eu-west-1.compute.amazonaws.com no-reply@yourdomain.com</p>
<p># postmap /etc/postfix/generic</p>
<p># /etc/init.d/postfix restart</p>
<p>2 domains<br />
2 different SSL Certificates</p>
<p># vi /etc/apache2/listen.conf<br />
NameVirtualHost ec2-xx-xx-xxx-xxx.eu-west-1.compute.amazonaws.com:80</p>
<p># vi vhosts.d/vhost.conf<br />
[...]<br />
<VirtualHost ec2-xx-xx-xxx-xxx.eu-west-1.compute.amazonaws.com:80><br />
    ServerAdmin server-admin@unexpectedit.com<br />
    DocumentRoot /srv/www/htdocs/ipascual.com/<br />
    ServerName www.unexpectedit.com<br />
    ServerAlias www.ipascual.com<br />
    <Directory "/srv/www/htdocs/ipascual.com/"><br />
        Options -Indexes FollowSymLinks<br />
        AllowOverride All<br />
        Order deny,allow<br />
        Deny from all<br />
    </Directory><br />
</VirtualHost><br />
[...]</p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/amazon-ec2-suse-linux-enterprise-server-for-magento/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Data Manipulation Handbook</title>
		<link>http://www.unexpectedit.com/webserver/linux-data-manipulation-handbook</link>
		<comments>http://www.unexpectedit.com/webserver/linux-data-manipulation-handbook#comments</comments>
		<pubDate>Sat, 20 Nov 2010 15:00:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>
		<category><![CDATA[awk]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=358</guid>
		<description><![CDATA[# # Remove duplicate lines # awk &#8216;!x[$0]++&#8217; FileWithDuplicates.csv > NewFile.csv # # Look for a string on files &#8211; recursive mode # grep -nir &#8211;color &#8216;text to find&#8217; *]]></description>
			<content:encoded><![CDATA[<p>#<br />
# Remove duplicate lines<br />
#<br />
awk &#8216;!x[$0]++&#8217; FileWithDuplicates.csv > NewFile.csv</p>
<p>#<br />
# Look for a string on files &#8211; recursive mode<br />
#<br />
grep -nir &#8211;color &#8216;text to find&#8217; *</p>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/linux-data-manipulation-handbook/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Box Handbook</title>
		<link>http://www.unexpectedit.com/webserver/unix-box-handbook</link>
		<comments>http://www.unexpectedit.com/webserver/unix-box-handbook#comments</comments>
		<pubDate>Thu, 05 Aug 2010 13:37:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Webserver]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[telnet test]]></category>

		<guid isPermaLink="false">http://www.unexpectedit.com/?p=271</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: bash; title: ; notranslate">
#
# Variable file, Write all global vars in
#
.bash_login
PATH=$PATH:/Applications/MAMP/Library/bin/
alias ls=&quot;ls -G&quot;

# Clear Historial
history -c

#
# Size of a folder
#
du -h -s --si

#
# Find
#
find . -name &quot;sendmail.cf&quot;
find . -type f -name &quot;*.java&quot; -exec grep -l sendEmailPassword {} \;

#
# Find and Replace
#
# Replace 'old.website.com' to '127.0.0.1/local.website.com' from file 'database.sql' to 'new-database.sql'
sed 's/old.website.com/127.0.0.1\/local.website.com/g' database.sql &gt; new-database.sql

# Replace recursively
find . -type f -exec sed -i '' 's/string-to-find/string-to-replace/g' {} \;

#
# YUM - software installation tool for Red Hat and Fedora
#
# Check packages installed
yum list installed
# Check updates
yum check-update
# Install a package
yum install openssl
# Install a package from a repository
yum --enablerepo=remi install php-pear
# Search for a package
yum --enablerepo=remi search apache
# Remove a package
yum remove telnet
# Get information
yum info telnet
# List files of an installed package. You will need package yum-utils. (yum install yum-utils)
repoquery --list telnet  

#
# rpm - RPM Package Manager is a package management system.
#
# Get all packages installed
rpm -qa
# Get info from a installed package
rpm -qi telnet
# Get list of files package installed
rpm -ql telnet
# Install a package
rpm -Uhv ftp://download.fedora.redhat.com/pub/archive/i386/os/Packages/fedora-release-*.noarch.rpm
# Erase a package
rpm -e telnet

#
# Debian - Ubuntu Aptitude
#
apt-cache search aMule

apt-get install aMule

apt-cache 

#
# Postfix - Sendmail
#
# List queue
postqueue -p

# Send queue
postqueue -f
# OR
sendmail -q

# Delete queue
postsuper -d ALL
postsuper -d ID

#
# Compress / De
#
tar czvf backup.tgz /var/www/htdocs
tar czvf backup-small.tgz --exclude='magento/media/*' --exclude='magento/var/log/ magento/

zip -9 -r -v backup.zip /var/www/htdocs

# Split a big file
split -b 784m Huge-File.dmg small-file-
# Join
cat small-file-* &gt; Huge-File.dmg

#
# Virtual Box
#
VBoxManage internalcommands sethduuid

#
# Mails (Mac Snow Leopard)
# See the mail queue
/usr/sbin/sendmail -bp
# Start Postfix daemon
 /usr/bin/sudo /bin/launchctl load -w /Library/LaunchDaemons/com.cutedgesystems.postfix.plist
# Stop Postfix daemon
 /usr/bin/sudo /bin/launchctl unload -w /Library/LaunchDaemons/com.cutedgesystems.postfix.plist
# Mail out folder
/var/spool/postfix/maildrop

#
# SFtp
#
vi ~/.ssh/config
host ec2-amazon-server-to-connect.com
IdentityFile ~/.ssh/serverkey.pem

sftp root@ec2-amazon-server-to-connect.com

#
# ps and Kill
#
# Kill all nacho's process
kill -9 `ps -u nacho -o &quot;pid=&quot;`
# Kill all php's process
kill -9 `ps -C php -o &quot;pid=&quot;`

#
# Test Mail Sever through telnet
#
telnet 127.0.0.1 25
EHLO 127.0.0.1
MAIL FROM:root@localhost
RCPT TO: ignacio@richardmason.net
DATA
SUBJECT: test message
Test message
.
</pre>
<div id="wpcr_respond_1"></div>]]></content:encoded>
			<wfw:commentRss>http://www.unexpectedit.com/webserver/unix-box-handbook/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

