<?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>has an internet?</title>
	<atom:link href="http://hasaninter.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://hasaninter.net</link>
	<description>Tales from adminland</description>
	<lastBuildDate>Fri, 01 Mar 2013 23:10:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Migrating a cPanel account to a base CentOS/nginx/php-fpm/mysql server</title>
		<link>http://hasaninter.net/2013/03/01/migrating-a-cpanel-account-to-a-base-centosnginxphp-fpmmysql-server/</link>
		<comments>http://hasaninter.net/2013/03/01/migrating-a-cpanel-account-to-a-base-centosnginxphp-fpmmysql-server/#comments</comments>
		<pubDate>Fri, 01 Mar 2013 23:10:48 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=129</guid>
		<description><![CDATA[Today, we&#8217;ll be setting up a base CentOS 5.9 server with nginx, php-fpm, mySQL, and extracting a cPanel account into it. This is useful if you have a single website you need to migrate from one provider into a dedicated environment, and you need it to run as predictably as possible with as little RAM <a href='http://hasaninter.net/2013/03/01/migrating-a-cpanel-account-to-a-base-centosnginxphp-fpmmysql-server/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Today, we&#8217;ll be setting up a base CentOS 5.9 server with nginx, php-fpm, mySQL, and extracting a cPanel account into it. This is useful if you have a single website you need to migrate from one provider into a dedicated environment, and you need it to run as predictably as possible with as little RAM as possible. Let&#8217;s get started by updating the operating system. Then we&#8217;ll proceed to setting up each individual service before extracting the backup into them all at once.</p>
<h2>1. Update the Operating System</h2>
<p>The first thing to do is make sure you&#8217;re running your latest-and-greatest before you open yourself up to the public.<br />
<code><br />
yum update -y<br />
</code><br />
Review the packages you just installed. If you see a kernel, reboot the system before continuing.</p>
<p>Next, let&#8217;s add the nginx repo. That just makes things easier, we probably don&#8217;t need to manually compile nginx.<br />
<code><br />
rpm -Uvh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm<br />
</code><br />
We also need the EPEL and IUS repositories in order to get some more updated PHP binaries as well as php-fpm.<br />
<code><br />
rpm -Uvh http://mirrors.servercentral.net/fedora/epel/5/i386/epel-release-5-4.noarch.rpm<br />
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-10.ius.el5.noarch.rpm<br />
</code></p>
<h2>2. Install and Configure nginx</h2>
<p>And now, let&#8217;s install (and start) nginx.<br />
<code><br />
yum -y install nginx<br />
/etc/init.d/nginx start<br />
</code><br />
At this point, you should be able to go to your server&#8217;s main IP address and see the nginx default page.</p>
<h2>3. Install mySQL</h2>
<p>Let&#8217;s install mySQL next, so we have the client and server set up before we try to install PHP to connect to it.<br />
<code><br />
yum install mysql-server<br />
</code><br />
Once you&#8217;ve installed the package, you still need to configure the mysql server:<br />
<code><br />
/etc/init.d/mysqld start<br />
mysql_secure_installation<br />
</code><br />
Answer some questions, and then create the file /root/.my.cnf in your favorite text editor. Add the following lines:<br />
<code><br />
[client]<br />
user=root<br />
pass=Your new root password<br />
</code><br />
This will allow you to connect to mySQL from the root user command line without specifying the mySQL root password.</p>
<h2>4. Install PHP/php-fpm</h2>
<p>Time to install PHP! At a minimum, you need the following packages:<br />
<code><br />
yum install php53u php53u-mysql php53u-fpm<br />
</code><br />
A more complete installation that would more closely mirror a typical cPanel server will look something like this:<br />
<code><br />
yum install php53u php53u-fpm php53u-mysql php53u-gd php53u-mbstring php53u-devel php53u-mcrypt php53u-imap php53u-pear php53u-pdo php53u-xml php53u-soap php53u-ioncube-loader<br />
</code><br />
And finally, start the php-fpm listener:<br />
<code><br />
/etc/init.d/php-fpm start<br />
</code></p>
<h2>5. Configure nginx to use php-fpm</h2>
<p>Now it&#8217;s time to configure your nginx configuration file to (securely!) pass PHP files to nginx. This information comes via <a href="https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/">this blog entry</a>, which contains some nifty information on why other blog entries on how to set up nginx and php-fpm leave you open for a really nasty attack. I&#8217;ve made a lot of modifications to the code though, so don&#8217;t copy directly from that blog, as it may not work. I found that I needed to set &#8220;root&#8221; under the PHP location as well to get the path info working.<br />
First, open your /etc/nginx/conf.d/default.conf file in your favorite text editor. You&#8217;ll likely see the following:<br />
<code><br />
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000<br />
#<br />
#location ~ \.php$ {<br />
#    root           html;<br />
#    fastcgi_pass   127.0.0.1:9000;<br />
#    fastcgi_index  index.php;<br />
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;<br />
#    include        fastcgi_params;<br />
#}<br />
</code><br />
I like to leave the default configuration example/comments intact in these files so I have something to refer back to if I break my server, so just add some empty lines below those comments and add the following:<br />
<code><br />
        # Pass all .php files onto a php-fpm/php-fcgi server.<br />
        location ~ \.php$ {<br />
        root   /home/user/public_html;</p>
<p>           fastcgi_split_path_info ^(.+\.php)(/.+)$;<br />
           include fastcgi_params;<br />
           fastcgi_index index.php;<br />
           fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;<br />
        #    fastcgi_intercept_errors on;<br />
add_header request $request_filename;<br />
if (-f $request_filename) {<br />
           fastcgi_pass 127.0.0.1:9000;<br />
}<br />
}<br />
</code><br />
You&#8217;re also going to want to uncomment the lines below that in the default file:<br />
<code><br />
    location ~ /\.ht {<br />
        deny  all;<br />
    }<br />
</code><br />
At this point you can make any other changes you want, including changing the &#8220;root&#8221; location (your document root; I recommend setting the same location you had in cPanel), your listen IP/port, your server_name, your error_pages, your &#8220;index&#8221; (you probably want to add &#8220;index.php&#8221; here), etc. At this point, you should also review /etc/php-fpm.conf and /etc/php-fpm.d/www.conf. The latter file especially impacts your permissions, as you will set the user PHP runs as on this. It might be a good idea to create a system user named the same thing as your cPanel user, and make sure your files are chowned and chmoded appropriately.</p>
<h2>6. Extract your cPanel backup</h2>
<p>You&#8217;re halfway there! It&#8217;s time to start picking apart the elements of a cPanel backup file. Let&#8217;s look at an extracted cpmove backup file.<br />
<code><br />
addons         homedir.tar  mysql/             resellerpackages/  userconfig/<br />
bandwidth/      httpfiles/    mysql.sql         sds               userdata/<br />
counters/       interchange/  mysql-timestamps/  sds2              va/<br />
cp/             locale/       nobodyfiles       shadow            vad/<br />
cron/           logaholic/    pds               shell             version<br />
dnszones/       logs/         proftpdpasswd     sslcerts/          vf/<br />
domainkeys/     meta/         psql/              ssldomain/<br />
fp/             mm/           quota             sslkeys/<br />
homedir/        mma/          resellerconfig/    suspended/<br />
homedir_paths  mms/          resellerfeatures/  suspendinfo/<br />
</code><br />
Ouch! Okay, let&#8217;s just mess with what&#8217;s absolutely essential to get this up and running.<br />
<code><br />
mv homedir.tar homedir/<br />
cd homedir/<br />
tar -xf homedir.tar<br />
ls<br />
</code><br />
Now this looks a little more familiar, right?<br />
<code><br />
bin/                    cpmove.psql/             homedir.tar  php/          tmp/<br />
cpanel3-skel/           cpmove.psql.1339066964/  mail/         public_ftp/   www/<br />
cpbackup-exclude.conf  etc/                     perl5/        public_html/<br />
</code><br />
Your directory structure may vary somewhat. The most important thing to us here is that public_html directory. Move it to wherever you want your document_root to be and set the ownership properly.<br />
<code><br />
mv public_html /home/user/<br />
chown -R user:user /home/user/public_html<br />
</code><br />
Now it&#8217;s time to import the mySQL databases and users. Users are stored in the &#8220;mysql.sql&#8221; file at the root of the backup; individual databases are stored in the mysql directory.<br />
<code><br />
cd ../<br />
mysql < mysql.sql<br />
for i in `ls | grep .sql | grep -v horde | grep -v roundcube | cut -d\. -f1`; do mysql < $i.create; mysql $i < $i.sql;done<br />
</code></p>
<h2>6. Manual configs</h2>
<p>Okay, now we're into some more dicey stuff this tutorial won't cover. You should check your backup file for things like PostgreSQL, cron jobs, SSL certificates, restoring log files/webalizer information, DNS, and e-mail. We might cover that in a later tutorial. At this point, however, you should have a fully-functional website! Just host DNS elsewhere, point it at your new server, and go!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2013/03/01/migrating-a-cpanel-account-to-a-base-centosnginxphp-fpmmysql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Whitelisting mod_security rules</title>
		<link>http://hasaninter.net/2012/08/03/whitelisting-mod_security-rules/</link>
		<comments>http://hasaninter.net/2012/08/03/whitelisting-mod_security-rules/#comments</comments>
		<pubDate>Sat, 04 Aug 2012 00:47:50 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=115</guid>
		<description><![CDATA[Apache&#8217;s mod_security is a system that scans URL data and data POSTed to the server in forms for malicious attacks such as XSS, SQL injections, etc. It comes with a default ruleset that always trips up a number of standard AJAX functions in applications like WordPress and Joomla, necessitating that rules be removed from the <a href='http://hasaninter.net/2012/08/03/whitelisting-mod_security-rules/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Apache&#8217;s mod_security is a system that scans URL data and data POSTed to the server in forms for malicious attacks such as XSS, SQL injections, etc. It comes with a default ruleset that always trips up a number of standard AJAX functions in applications like WordPress and Joomla, necessitating that rules be removed from the mod_security configuration to allow the site to function properly. The method of removing these rules under Apache 2 is by whitelisting the individual rules in the VHost entry for the domain. Here&#8217;s how to do it in cPanel.</p>
<h1>Is mod_security enabled?</h1>
<p><code>root@server [~]# httpd -M | grep sec<br />
security2_module (shared)</code></p>
<p>Yep.</p>
<h1>A typical mod_security error message</h1>
<p><code>[Sun Jul 29 18:29:47 2012] [error] [client 1.2.3.4] ModSecurity: Access denied with code 403 (phase 2). Match of "rx (?:/event\\\\.ng/|horde/services/go\\\\.php|tiki-view_cache\\\\.php|^/\\\\?out=http://|homecounter\\\\.php\\\\?offerid=.*ureferrer=http|__utm\\\\.gif\\\\?|/plugins/wpeditimage/editimage\\\\.html|/spc\\\\.php)" against "REQUEST_URI" required. [file "/usr/local/apache/conf/modsec/50_asl_rootkits.conf"] [line "53"] [id "390145"] [rev "10"] [msg "Atomicorp.com UNSUPPORTED DELAYED Rules: Rootkit attack: Generic Attempt to install rootkit"] [data "=http://www.hackers-web-site.com/what/e.txt?"] [severity "CRITICAL"] [hostname "www.domain.com"] [uri "/index.php"] [unique_id "UBVB02B-nBoACs9n0p4AAAAH"]</code></p>
<p>The error log for mod_security is /usr/local/apache/logs/error_log. There are 2 important pieces of information contained in this error:</p>
<ul>
<li />[id "390145"]<br />
This is the mod_security rule ID number. We will use this to tell mod_security which rule we want to whitelist.</p>
<li />[hostname "www.domain.com"]<br />
This is the name of the VirtualHost under which the error was generated. This is important because whitelisting a mod_security rule for a domain doesn&#8217;t whitelist it for the whole account; subdomains, addon domains, etc all have separate whitelists.
</ul>
<h1>Creating the userdata includes</h1>
<p>mkdir -p /usr/local/apache/conf/userdata/<i>std</i>/2/<b>user</b>/<b><i>domain.com</i></b><br />
<code><br />
root@server [~]# mkdir -p /usr/local/apache/conf/userdata/std/2/user/domain.com</code></p>
<p>In the above example, we are setting up an <a href="http://docs.cpanel.net/twiki/bin/view/EasyApache3/InsideVHost">Inside VHost include</a>. The italic <i>std</i> indicates this is being done in a port 80 (standard/non-secure) VirtualHost, the bold <b>user</b> is the cPanel username of the account, and the bold and italic <b><i>domain.com</i></b> is the hostname from the error message above (we discard www because that&#8217;s just a ServerAlias under the same VHost). Once we create the userdata include directory, it&#8217;s time to set up the configuration file to include. We&#8217;ll use nano because it&#8217;s the best text editor.</p>
<p>nano -w /usr/local/apache/conf/userdata/<i>std</i>/2/<b>user</b>/<b><i>domain.com</i></b>/<b><i>domain.com</i></b>.conf<br />
<code><br />
root@server [~]# /usr/local/apache/conf/userdata/std/2/user/domain.com/domain.com.conf</code></p>
<p>You can name the file anything as long as it ends in .conf; I prefer to use <b><i>domain.com</i></b>.conf for clarity and simplicity. Now let&#8217;s whitelist some mod_security rules.</p>
<p><code>SecRuleRemoveById 390145</code></p>
<p>Notice that we used <b>390145</b> from the error message above. If this site was generating errors from multiple IDs, we&#8217;d put in multiple SecRuleRemoveById lines.</p>
<h1>Enabling the userdata includes in Apache conf</h1>
<p><code>/scripts/ensure_vhost_includes --user=user</code></p>
<p>This uncomments a line in the VirtualHost entry in httpd.conf for this domain to include any .conf files in /usr/local/apache/conf/userdata/<i>std</i>/2/<b>user</b>/<b><i>domain.com</i></b>/</p>
<p><code>/usr/local/cpanel/bin/apache_conf_distiller --update<br />
/usr/local/cpanel/bin/build_apache_conf</code></p>
<p>These compile and distill the changes into Apache&#8217;s configuration.</p>
<h1>Testing</h1>
<p>The first thing to check is to ensure that the following line in the VirtualHost entry for <b><i>domain.com</i></b> is uncommented:</p>
<p><code>Include "/usr/local/apache/conf/userdata/std/2/user/domain.com/*.conf"</code></p>
<p>The only other way to test this is to reproduce the issue and tail the Apache error log. Make sure you have reproduction instructions available; many scripts will trigger more than one SecRule, but you&#8217;ll only see the first one due to the request being blocked.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/08/03/whitelisting-mod_security-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uninstall CloudLinux</title>
		<link>http://hasaninter.net/2012/07/23/uninstall-cloudlinux/</link>
		<comments>http://hasaninter.net/2012/07/23/uninstall-cloudlinux/#comments</comments>
		<pubDate>Tue, 24 Jul 2012 03:42:59 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=108</guid>
		<description><![CDATA[Uninstalling CloudLinux is a fairly involved process, as the CloudLinux repos ship their own version of many software packages that need to be re-downgraded to CentOS defaults. I will be using this guide as a basis, with a few tweaks because uninstalling kernels with yum makes me nervous (dependency issues mean that you could be <a href='http://hasaninter.net/2012/07/23/uninstall-cloudlinux/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Uninstalling CloudLinux is a fairly involved process, as the CloudLinux repos ship their own version of many software packages that need to be re-downgraded to CentOS defaults. I will be using <a href="http://www.linuxspy.info/tag/uninstall-cloudlinux-from-cpanel/">this guide</a> as a basis, with a few tweaks because uninstalling kernels with yum makes me nervous (dependency issues mean that you could be uninstalling the entire glibc system from your server&#8230;)</p>
<li />Run the CloudLinux uninstaller<br />
<code>/usr/local/cpanel/bin/cloudlinux_system_install -c</code></p>
<li />Update any packages available from your newly-default CentOS repos<br />
<code>yum upgrade -y </code></p>
<li />Recompile Apache to remove liblve and mod_hostinglimits<br />
<code>/scripts/easyapache --build</code></p>
<li />Install the CentOS kernel<br />
<code>yum --disableexcludes=all install kernel</code></p>
<li />Manually uninstall the CloudLinux kernel<br />
<code>rpm -qa |awk '/^kernel.*lve/ {print $1|"xargs rpm -e --nodeps"}'</code></p>
<li />Make sure the uninstaller updated grub<br />
<code>grep -r lve /boot/*</code><br />
If this finds anything in menu.lst or any other GRUB config files, manually remove the entries for kernels with &#8220;lve&#8221; in the name.</p>
<li />Reinstall the packages CloudLinux supplied with CentOS defaults<br />
<code>rpm -qa --qf "[%{VENDOR} %{NAME}\n]"|awk '/CloudLinux/ {print $2|"xargs yum reinstall -y"}'</code></p>
<li />Downgrade any packages supplied by CloudLinux with CentOS versions<br />
<code>rpm -qa --qf "[%{VENDOR} %{NAME}\n]"|awk '/CloudLinux/ {print $2|"xargs yum downgrade -y"}'</code></p>
<li />Remove any packages supplied by CloudLinux not available in CentOS<br />
<code>rpm -qa --qf "[%{VENDOR} %{NAME}\n]"|awk '/CloudLinux/ {print $2|"xargs yum erase -y"}'</code></p>
<li />Final upgrade. Make sure kernel-headers and kernel-devel are installed.<br />
<code>yum upgrade -y<br />
yum install kernel-headers kernel-devel</code></p>
<li />Reboot<br />
<code>shutdown -rf now</code>
</ol>
<p>That should be it. If Apache fails to start, try another EasyApache build.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/07/23/uninstall-cloudlinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Latest ffmpeg on CentOS</title>
		<link>http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/</link>
		<comments>http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/#comments</comments>
		<pubDate>Sat, 28 Apr 2012 08:38:48 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=100</guid>
		<description><![CDATA[It&#8217;s been a long time coming, but here&#8217;s my guide to install the latest ffmpeg and associated packages for a video upload site on base CentOS, no cPanel required (if Google got you here and you have cPanel, try the cPanel ffmpeg guide). This article assumes you&#8217;ve already set up your HTTP daemon (Apache, nginx, <a href='http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a long time coming, but here&#8217;s my guide to install the latest ffmpeg and associated packages for a video upload site on base CentOS, no cPanel required (if Google got you here and you have cPanel, try <a href="http://hasaninter.net/2011/04/01/cpanel-ffmpeg-install/">the cPanel ffmpeg guide</a>). This article assumes you&#8217;ve already set up your HTTP daemon (Apache, nginx, lighttpd, litespeed, etc), scripting agent (PHP), and database provider (mySQL, PostgreSQL, etc). The commands in this guide assume you are running the latest CentOS 5.8 64-bit. Some modifications may be necessary for other architectures and versions of CentOS.</p>
<ol>
<li>Make sure you&#8217;re up to date</li>
<p>Make sure you&#8217;re on the latest CentOS branch. We&#8217;re installing the latest version of ffmpeg, and if you&#8217;re not running the latest version of your CentOS branch, you may run into unexpected issues.<br />
<code><br />
yum update<br />
</code><br />
Install whatever is required, and compatible with your other software. If you update your kernel, reboot before continuing.</p>
<li>Extra Repositories</li>
<p>RPMForge is a useful, fully-compatible extra repository. We will use it for a number of packages that don&#8217;t need to be bleeding-edge. For more information, see <a href="http://wiki.centos.org/AdditionalResources/Repositories/RPMForge">the CentOS wiki</a>.<br />
<code><br />
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br />
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt<br />
rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br />
rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm<br />
</code></p>
<li>Development Tools</li>
<p>You must have the required packages to download and compile the source code.<br />
<code><br />
yum groupinstall "Development Tools"<br />
yum install subversion git<br />
</code></p>
<li>Install RPM libraries</li>
<p>Some libraries don&#8217;t need to be bleeding-edge. We&#8217;ll install those now.<br />
<code><br />
yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel libXext libXext-devel flvtool2<br />
</code></p>
<li>ldconfig</li>
<p>We need to make sure ldconfig is checking the correct directories for libraries.<br />
<code><br />
echo /usr/local/lib >> /etc/ld.so.conf; ldconfig<br />
</code></p>
<li>Download libraries</li>
<p>Okay, here&#8217;s the big one. It&#8217;s probably a good idea to go ahead and copy+paste this whole code block into your terminal at once to save time. One note; the official distribution release of ffmpeg-php no longer compiles. The SVN version available <a href="http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/">here</a> works, but the SVN tarball link <a href="http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/?view=tar">here</a> can&#8217;t easily be downloaded in a terminal session, so I&#8217;ve rehosted the file here on this server. This is not my file, I haven&#8217;t modified it, and I take no responsibility for it &#8211; it&#8217;s merely a copy of the file available from the above link.<br />
<code><br />
cd /usr/local/src<br />
wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz<br />
tar zxf lame-3.99.5.tar.gz<br />
wget http://hasaninter.net/ffmpeg-php.tar.gz<br />
tar xzf ffmpeg-php.tar.gz<br />
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz<br />
tar xzf libvorbis-1.3.3.tar.gz<br />
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz<br />
tar xzf libogg-1.3.0.tar.gz<br />
wget http://iweb.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz<br />
tar xzf opencore-amr-0.1.3.tar.gz<br />
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2<br />
tar xjf libtheora-1.1.1.tar.bz2<br />
wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz<br />
tar zxf xvidcore-1.3.2.tar.gz<br />
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz<br />
tar zxf faad2-2.7.tar.gz<br />
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz<br />
tar zxf faac-1.28.tar.gz<br />
mkdir /usr/local/lib/codecs<br />
wget ftp://ftp.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2<br />
tar -jxf all-20110131.tar.bz2<br />
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz<br />
tar zxf yasm-1.2.0.tar.gz<br />
cp all-20110131/* /usr/local/lib/codecs/<br />
chmod -R 755 /usr/local/lib/codecs/<br />
mkdir /usr/local/src/tmp<br />
chmod 777 /usr/local/src/tmp<br />
export TMPDIR=/usr/local/src/tmp<br />
svn co https://gpac.svn.sourceforge.net/svnroot/gpac/trunk/gpac gpac<br />
git clone git://git.videolan.org/x264.git<br />
git clone git://git.videolan.org/ffmpeg.git ffmpeg<br />
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer<br />
</code></p>
<li>Compile everything</li>
<p>Here we go! This is the hard part, where we compile bleeding-edge libraries. At the time this was posted, this all worked. If you run into any errors, try Googling them. If you still can&#8217;t figure it out (or more importantly, if you do!) please comment here and I&#8217;ll edit this post with the latest fixes.</p>
<ol type="a">
<li>Lame</li>
<p><code><br />
cd /usr/local/src/lame-3.99.5/<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libogg</li>
<p><code><br />
cd /usr/local/src/libogg-1.3.0<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libvorbis</li>
<p><code><br />
cd /usr/local/src/libvorbis-1.3.3<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>yasm</li>
<p><code><br />
cd /usr/local/src/yasm-1.2.0<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libxvid</li>
<p><code><br />
cd /usr/local/src/xvidcore/build/generic<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libx264</li>
<p><code><br />
cd /usr/local/src/x264<br />
./configure --enable-shared<br />
make<br />
make install<br />
</code></p>
<li>Opencore-amr</li>
<p><code><br />
cd /usr/local/src/opencore-amr-0.1.3<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Libtheora</li>
<p><code><br />
cd /usr/local/src/libtheora-1.1.1<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Fadd2</li>
<p><code><br />
cd /usr/local/src/faad2-2.7<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>Faac</li>
<p><code><br />
cd /usr/local/src/faac-1.28<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>MP4Box</li>
<p><code><br />
cd /usr/local/src/gpac<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>mplayer</li>
<p><code><br />
cd /usr/local/src/mplayer/<br />
./configure --enable-jpeg<br />
make<br />
make install<br />
</code></p>
<li>ffmpeg</li>
<p><code><br />
cd /usr/local/src/ffmpeg<br />
./configure --enable-libmp3lame --enable-libvorbis --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libtheora --enable-version3 --enable-gpl --enable-libxvid<br />
make<br />
make install<br />
</code></p>
<li>ffpmeg-php</li>
<p><code><br />
cd /usr/local/src/ffmpeg-php<br />
phpize<br />
./configure<br />
make<br />
make install<br />
</code></p>
<li>php.ini</li>
<p>If you&#8217;re adding in the ffmpeg module to PHP (which this guide assumes you are), you need to add the extension to PHP. Again, this guide assumes you&#8217;re using PHP on Apache with CentOS 5.<br />
<code><br />
echo "extension=ffmpeg.so" > /etc/php.d/ffmpeg.ini<br />
/etc/init.d/httpd restart<br />
</code>
</ol>
<li>ldconfig</li>
<p>To ensure that all of the libraries are loaded and linkable by ffmpeg, etc, run:<br />
<code><br />
ldconfig<br />
</code>
</ol>
<p>That&#8217;s it! There are a few tests you can run to ensure that this is actually installed properly. Here are the two most important.</p>
<p><code><br />
php -m | grep ffmpeg<br />
ffmpeg<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/28/latest-ffmpeg-on-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RCS, or, oh my god how do I just get my old httpd.conf back</title>
		<link>http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/</link>
		<comments>http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 09:54:03 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=92</guid>
		<description><![CDATA[So, you just did something that broke your entire everything. You&#8217;ve tried restoring backups, or you don&#8217;t have any. You&#8217;ve tried correcting the cPanel userdata files, but for some reason, httpd.conf just isn&#8217;t changing. And then you notice this file httpd.conf,v &#8211; this beautiful file, that contains all of the changes you&#8217;ve ever made to <a href='http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>So, you just did something that broke your entire everything. You&#8217;ve tried restoring backups, or you don&#8217;t have any. You&#8217;ve tried correcting the cPanel userdata files, but for some reason, httpd.conf just isn&#8217;t changing. And then you notice this file httpd.conf,v &#8211; this beautiful file, that contains all of the changes you&#8217;ve ever made to httpd.conf, and has exactly the information you need in it. But how do you convert httpd.conf,v to httpd.conf? Using RCS!</p>
<ol>
<li>Make backups</li>
<p>You got into this situation because you didn&#8217;t make enough backups, you silly little lamb, so let&#8217;s not make that mistake again.<br />
<code><br />
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.broken<br />
cp /usr/local/apache/conf/httpd.conf /root<br />
cp /usr/local/apache/conf/httpd.conf\,v /root<br />
</code></p>
<li>Find the revision you need</li>
<p>The file is formatted with revision numbers, dates, author information, etc. It&#8217;ll look something like this.<br />
<code><br />
1.517<br />
date    2012.04.11.10.27.03;    author root;    state Exp;<br />
branches;<br />
next    1.516;<br />
</code><br />
Here&#8217;s an example of a revision with actual data. Let&#8217;s say you accidentally deleted this vhost and you need it back. We&#8217;ll be using the revision from this code block in the following examples.<br />
<code><br />
1.365<br />
log<br />
@"Modified by /usr/local/cpanel/scripts/killvhost After removing vhosts"<br />
@<br />
text<br />
@a8725 32<br />
&lt;VirtualHost 1.2.3.4:80&gt;<br />
    ServerName test.com<br />
    ServerAlias www.test.com<br />
    DocumentRoot /home/test/public_html<br />
    ServerAdmin webmaster@@test.com<br />
    ## User test # Needed for Cpanel::ApacheConf<br />
    &lt;IfModule mod_suphp.c&gt;<br />
        suPHP_UserGroup test test<br />
    &lt;/IfModule&gt;<br />
    &lt;IfModule concurrent_php.c&gt;<br />
        php4_admin_value open_basedir "/home/test:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"<br />
        php5_admin_value open_basedir "/home/test:/usr/lib/php:/usr/local/lib/php:/tmp"<br />
    &lt;/IfModule&gt;<br />
    &lt;IfModule !concurrent_php.c&gt;<br />
        &lt;IfModule mod_php4.c&gt;<br />
            php_admin_value open_basedir "/home/test:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"<br />
        &lt;/IfModule&gt;<br />
        &lt;IfModule mod_php5.c&gt;<br />
            php_admin_value open_basedir "/home/test:/usr/lib/php:/usr/local/lib/php:/tmp"<br />
        &lt;/IfModule&gt;<br />
        &lt;IfModule sapi_apache2.c&gt;<br />
            php_admin_value open_basedir "/home/test:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"<br />
    &lt;/IfModule&gt;<br />
    &lt;IfModule !mod_disable_suexec.c&gt;<br />
        SuexecUserGroup onst onst<br />
    &lt;/IfModule&gt;<br />
    CustomLog /usr/local/apache/domlogs/test.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."<br />
    CustomLog /usr/local/apache/domlogs/test.com combined<br />
    Options -ExecCGI -Includes<br />
    RemoveHandler cgi-script .cgi .pl .plx .ppl .perl<br />
&lt;/VirtualHost&gt;<br />
@<br />
</code><br />
Let&#8217;s take this apart a bit.<br />
<strong>1.365</strong> &#8211; this is our revision number. This tells the RCS command to roll back to the version with this data. Location the correct revision to restore is the most important part of the process.</p>
<li>Revert</li>
<p>Now it&#8217;s time to go ahead and revert the files. Make sure you&#8217;re in /root and not overwriting your existing httpd.conf first.<br />
<code><br />
cd /root<br />
co -l -r1.365 httpd.conf<br />
</code><br />
This will ask you if you wish to replace the existing httpd.conf. Say yes. The /root/httpd.conf file will be overwritten with the RCS version from revision 1.356.</p>
<li>Restore httpd.conf</li>
<p><code><br />
cp /root/httpd.conf /usr/local/apache/conf<br />
/etc/init.d/httpd restart<br />
</code><br />
Overwrite your existing httpd.conf file and restart Apache. That&#8217;s it!
</ul>
<p><strong>Final notes</strong>: since this is cPanel, the httpd.conf you just made will eventually get overwritten with the broken one from cPanel configs. This is just a stop-gap measure to get the sites up while you investigate the real problem. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/27/rcs-or-oh-my-god-how-do-i-just-get-my-old-httpd-conf-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable SpamAssassin and Anti-Virus filtering on all domains (Plesk)</title>
		<link>http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/</link>
		<comments>http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 11:06:41 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=89</guid>
		<description><![CDATA[Just a few quick commandlets. These will enable SpamAssassin on all existing e-mail accounts: for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true And enable the anti-virus scanner for inbound and outbound mail on all <a href='http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Just a few quick commandlets. These will enable SpamAssassin on all existing e-mail accounts:<br />
<code><br />
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true<br />
</code><br />
And enable the anti-virus scanner for inbound and outbound mail on all existing e-mail accounts:<br />
<code><br />
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/mail -u $i -antivirus inout; done<br />
</code><br />
To delete all spam messages with a score of 5 or higher:<br />
<code><br />
for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true -hits 5 -action del; done<br />
</code><br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/23/enable-spamassassin-and-anti-virus-filtering-on-all-domains-plesk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple/secondary memcached instance</title>
		<link>http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/</link>
		<comments>http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 09:51:51 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=86</guid>
		<description><![CDATA[Need to run 2 versions of memcached? I have no idea why you&#8217;d need to do this, but I had a request for it tonight, and all of the Google results for it are terrible. Here&#8217;s what you need to know. /etc/sysconfig/memcached2 PORT="11212" USER="memcached" MAXCONN="8000" CACHESIZE="1024" OPTIONS="" /etc/init.d/memcached2 #! /bin/sh # # chkconfig: - 55 <a href='http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Need to run 2 versions of memcached? I have no idea why you&#8217;d need to do this, but I had a request for it tonight, and all of the Google results for it are terrible. Here&#8217;s what you need to know.</p>
<ol>
<li>/etc/sysconfig/memcached2</li>
<p><code><br />
PORT="11212"<br />
USER="memcached"<br />
MAXCONN="8000"<br />
CACHESIZE="1024"<br />
OPTIONS=""<br />
</code></p>
<li>/etc/init.d/memcached2</li>
<p><code><br />
#! /bin/sh<br />
#<br />
# chkconfig: - 55 45<br />
# description:  The memcached daemon is a network memory cache service.<br />
# processname: memcached<br />
# config: /etc/sysconfig/memcached<br />
# pidfile: /var/run/memcached/memcached.pid</p>
<p># Standard LSB functions<br />
#. /lib/lsb/init-functions</p>
<p># Source function library.<br />
. /etc/init.d/functions</p>
<p>PORT=11212<br />
USER=memcached<br />
MAXCONN=1024<br />
CACHESIZE=64<br />
OPTIONS=""</p>
<p>if [ -f /etc/sysconfig/memcached2 ];then<br />
        . /etc/sysconfig/memcached2<br />
fi</p>
<p># Check that networking is up.<br />
. /etc/sysconfig/network</p>
<p>if [ "$NETWORKING" = "no" ]<br />
then<br />
        exit 0<br />
fi</p>
<p>RETVAL=0<br />
prog="memcached"</p>
<p>start () {<br />
        echo -n $"Starting $prog: "<br />
        # insure that /var/run/memcached has proper permissions<br />
    if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then<br />
        chown $USER /var/run/memcached<br />
    fi</p>
<p>        daemon --pidfile /var/run/memcached/memcached2.pid memcached -d -p $PORT -u $USER  -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached2.pid $OPTIONS<br />
        RETVAL=$?<br />
        echo<br />
        [ $RETVAL -eq 0 ] &#038;&#038; touch /var/lock/subsys/memcached2<br />
}<br />
stop () {<br />
        echo -n $"Stopping $prog: "<br />
        killproc -p /var/run/memcached/memcached2.pid /usr/bin/memcached<br />
        RETVAL=$?<br />
        echo<br />
        if [ $RETVAL -eq 0 ] ; then<br />
            rm -f /var/lock/subsys/memcached2<br />
            rm -f /var/run/memcached2.pid<br />
        fi<br />
}</p>
<p>restart () {<br />
        stop<br />
        start<br />
}</p>
<p># See how we were called.<br />
case "$1" in<br />
  start)<br />
        start<br />
        ;;<br />
  stop)<br />
        stop<br />
        ;;<br />
  status)<br />
        status memcached<br />
        ;;<br />
  restart|reload|force-reload)<br />
        restart<br />
        ;;<br />
  condrestart)<br />
        [ -f /var/lock/subsys/memcached2 ] &#038;&#038; restart || :<br />
        ;;<br />
  *)<br />
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"<br />
        exit 1<br />
esac</p>
<p>exit $?<br />
</code></p>
<li>Configure the service to run on start-up</li>
<p><code><br />
chmod +x /etc/init.d/memcached2<br />
chkconfig memcached2 on<br />
/etc/init.d/memcached2<br />
</code><br />
That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/13/multiplesecondary-memcached-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing mod_pagespeed on a cPanel/WHM server</title>
		<link>http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/</link>
		<comments>http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 08:27:15 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=80</guid>
		<description><![CDATA[Google&#8217;s mod_pagespeed is an Apache module for performance optimization. It can be used to increase the speed of pages served through Apache. This module is compatible with cPanel and WHM&#8217;s Apache setup, and it&#8217;s pretty easy to install. Download the correct mod_pagespeed RPM for your architecture. mod_pagespeed has RPMs available for 32-bit and 64-bit systems. <a href='http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p><a href="https://developers.google.com/speed/pagespeed/mod">Google&#8217;s mod_pagespeed</a> is an Apache module for performance optimization. It can be used to increase the speed of pages served through Apache. This module is compatible with cPanel and WHM&#8217;s Apache setup, and it&#8217;s pretty easy to install.</p>
<ol>
<li>Download the correct mod_pagespeed RPM for your architecture.</li>
<p>mod_pagespeed has RPMs available for 32-bit and 64-bit systems. First, let&#8217;s download the RPM files.<br />
For 32-bit:<br />
<code><br />
cd /usr/local/src<br />
mkdir mod_pagespeed<br />
cd mod_pagespeed<br />
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.rpm<br />
</code><br />
For 64-bit:<br />
<code><br />
cd /usr/local/src/<br />
mkdir mod_pagespeed<br />
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_x86_64.rpm<br />
</code></p>
<li>Extract the necessary files.</li>
<p>I&#8217;m going to assume a 64-bit system from here on out. If you&#8217;re on a 32-bit system, the extracted files exist in slightly different paths; adjust accordingly.<br />
<code><br />
rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv<br />
cp usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/<br />
chmod 755 /usr/local/apache/modules/mod_pagespeed.so<br />
</code></p>
<li>Create pagespeed directories.</li>
<p><code><br />
mkdir -p /var/mod_pagespeed/{cache,files}<br />
chown nobody:nobody /var/mod_pagespeed/*<br />
</code></p>
<li>Enable mod_deflate (required for mod_pagespeed).</li>
<p>The location of your httpd source directory will vary depending on the version of Apache you have installed. The quickest way to find the correct location is tab completion.<br />
<code><br />
/usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-[tab]/modules/filters/mod_deflate.c<br />
</code></p>
<li>Set up your mod_pagespeed configuration.</li>
<p>Add the following to the Apache configuration files. The simplest way to do this is to create a new configuration file called /usr/local/apache/conf/pagespeed.conf and then include that using the cPanel include files. Place the following in pagespeed.conf:<br />
<code><br />
LoadModule pagespeed_module modules/mod_pagespeed.so</p>
<p># Only attempt to load mod_deflate if it hasn't been loaded already.<br />
&lt;IfModule !mod_deflate.c&gt;<br />
 LoadModule deflate_module modules/mod_deflate.so<br />
&lt;/IfModule&gt;<br />
&lt;IfModule pagespeed_module&gt;<br />
    # Turn on mod_pagespeed. To completely disable mod_pagespeed, you<br />
    # can set this to "off".<br />
    ModPagespeed on</p>
<p>    # Direct Apache to send all HTML output to the mod_pagespeed<br />
    # output handler.<br />
    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html</p>
<p>    # The ModPagespeedFileCachePath and<br />
    # ModPagespeedGeneratedFilePrefix directories must exist and be<br />
    # writable by the apache user (as specified by the User<br />
    # directive).<br />
    ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"<br />
    ModPagespeedGeneratedFilePrefix      "/var/mod_pagespeed/files/"</p>
<p>    # Override the mod_pagespeed 'rewrite level'. The default level<br />
    # "CoreFilters" uses a set of rewrite filters that are generally<br />
    # safe for most web pages. Most sites should not need to change<br />
    # this value and can instead fine-tune the configuration using the<br />
    # ModPagespeedDisableFilters and ModPagespeedEnableFilters<br />
    # directives, below. Valid values for ModPagespeedRewriteLevel are<br />
    # PassThrough, CoreFilters and TestingCoreFilters.<br />
    #<br />
    # ModPagespeedRewriteLevel PassThrough</p>
<p>    # Explicitly disables specific filters. This is useful in<br />
    # conjuction with ModPagespeedRewriteLevel. For instance, if one<br />
    # of the filters in the CoreFilters needs to be disabled for a<br />
    # site, that filter can be added to<br />
    # ModPagespeedDisableFilters. This directive contains a<br />
    # comma-separated list of filter names, and can be repeated.<br />
    #<br />
    # ModPagespeedDisableFilters rewrite_images</p>
<p>    # Explicitly enables specific filters. This is useful in<br />
    # conjuction with ModPagespeedRewriteLevel. For instance, filters<br />
    # not included in the CoreFilters may be enabled using this<br />
    # directive. This directive contains a comma-separated list of<br />
    # filter names, and can be repeated.<br />
    #<br />
    # ModPagespeedEnableFilters rewrite_javascript,rewrite_css<br />
    # ModPagespeedEnableFilters collapse_whitespace,elide_attributes</p>
<p>    # ModPagespeedDomain<br />
    # authorizes rewriting of JS, CSS, and Image files found in this<br />
    # domain. By default only resources with the same origin as the<br />
    # HTML file are rewritten. For example:<br />
    #<br />
    #   ModPagespeedDomain cdn.myhost.com<br />
    #<br />
    # This will allow resources found on http://cdn.myhost.com to be<br />
    # rewritten in addition to those in the same domain as the HTML.<br />
    #<br />
    # Wildcards (* and ?) are allowed in the domain specification. Be<br />
    # careful when using them as if you rewrite domains that do not<br />
    # send you traffic, then the site receiving the traffic will not<br />
    # know how to serve the rewritten content.</p>
<p>    # Other defaults (cache sizes and thresholds):<br />
    #<br />
    # ModPagespeedFileCacheSizeKb          102400<br />
    # ModPagespeedFileCacheCleanIntervalMs 3600000<br />
    # ModPagespeedLRUCacheKbPerProcess     1024<br />
    # ModPagespeedLRUCacheByteLimit        16384<br />
    # ModPagespeedCssInlineMaxBytes        2048<br />
    # ModPagespeedImageInlineMaxBytes      2048<br />
    # ModPagespeedCssImageInlineMaxBytes   2048<br />
    # ModPagespeedJsInlineMaxBytes         2048<br />
    # ModPagespeedCssOutlineMinBytes       3000<br />
    # ModPagespeedJsOutlineMinBytes        3000</p>
<p>    # Bound the number of images that can be rewritten at any one time; this<br />
    # avoids overloading the CPU.  Set this to 0 to remove the bound.<br />
    #<br />
    # ModPagespeedImageMaxRewritesAtOnce      8</p>
<p>    # Settings for image optimization:<br />
    #<br />
    # Jpeg recompression quality (0 to 100, -1 strips metadata):<br />
    # ModPagespeedJpegRecompressionQuality -1<br />
    #<br />
    # Percent of original image size below which optimized images are retained:<br />
    # ModPagespeedImageLimitOptimizedPercent 100<br />
    #<br />
    # Percent of original image area below which image resizing will be<br />
    # attempted:<br />
    # ModPagespeedImageLimitResizeAreaPercent 100</p>
<p>    # When Apache is set up as a browser proxy, mod_pagespeed can record<br />
    # web-sites as they are requested, so that an image of the web is built up<br />
    # in the directory of the proxy administrator's choosing.  When ReadOnly is<br />
    # on, only files already present in the SlurpDirectory are served by the<br />
    # proxy.<br />
    #<br />
    # ModPagespeedSlurpDirectory ...<br />
    # ModPagespeedSlurpReadOnly on</p>
<p>    # The maximum URL size is generally limited to about 2k characters<br />
    # due to IE: See http://support.microsoft.com/kb/208427/EN-US.<br />
    # Apache servers by default impose a further limitation of about<br />
    # 250 characters per URL segment (text between slashes).<br />
    # mod_pagespeed circumvents this limitation, but if you employ<br />
    # proxy servers in your path you may need to re-impose it by<br />
    # overriding the setting here.  The default setting is 1024<br />
    # characters.<br />
    #<br />
    # ModPagespeedMaxSegmentLength 250</p>
<p>    # Uncomment this if you want to prevent mod_pagespeed from combining files<br />
    # (e.g. CSS files) across paths<br />
    #<br />
    # ModPagespeedCombineAcrossPaths off</p>
<p>    # Explicitly tell mod_pagespeed to load some resources from disk.<br />
    # This will speed up load time and update frequency.<br />
    #<br />
    # This should only be used for static resources which do not need<br />
    # specific headers set or other processing by Apache.<br />
    #<br />
    # Both URL and filesystem path should specify directories and<br />
    # filesystem path must be absolute (for now).<br />
    #<br />
    # ModPagespeedLoadFromFile "http://example.com/static/" "/var/www/static/"</p>
<p>    # Enables server-side instrumentation and statistics.  If this rewriter is<br />
    # enabled, then each rewritten HTML page will have instrumentation javacript<br />
    # added that sends latency beacons to /mod_pagespeed_beacon.  These<br />
    # statistics can be accessed at /mod_pagespeed_statistics.  You must also<br />
    # enable the mod_pagespeed_statistics and mod_pagespeed_beacon handlers<br />
    # below.<br />
    #<br />
    # ModPagespeedEnableFilters add_instrumentation</p>
<p>    # Uncomment the following line so that ModPagespeed will not cache or<br />
    # rewrite resources with Vary: in the header, e.g. Vary: User-Agent.<br />
    # ModPagespeedRespectVary on</p>
<p>    # This handles the client-side instrumentation callbacks which are injected<br />
    # by the add_instrumentation filter.<br />
    # You can use a different location by adding the ModPagespeedBeaconUrl<br />
    # directive; see the documentation on add_instrumentation.<br />
    &lt;Location /mod_pagespeed_beacon&gt;<br />
          SetHandler mod_pagespeed_beacon<br />
    &lt;/Location&gt;</p>
<p>    # Uncomment the following line if you want to disable statistics entirely.<br />
    #<br />
    # ModPagespeedStatistics off</p>
<p>    # This page lets you view statistics about the mod_pagespeed module.<br />
    &lt;Location /mod_pagespeed_statistics&gt;<br />
        Order allow,deny<br />
        # You may insert other "Allow from" lines to add hosts you want to<br />
        # allow to look at generated statistics.  Another possibility is<br />
        # to comment out the "Order" and "Allow" options from the config<br />
        # file, to allow any client that can reach your server to examine<br />
        # statistics.  This might be appropriate in an experimental setup or<br />
        # if the Apache server is protected by a reverse proxy that will<br />
        # filter URLs in some fashion.<br />
        Allow from localhost<br />
        Allow from 127.0.0.1<br />
        SetHandler mod_pagespeed_statistics<br />
    &lt;/Location&gt;</p>
<p>    # Page /mod_pagespeed_message lets you view the latest messages from<br />
    # mod_pagespeed, regardless of log-level in your httpd.conf<br />
    # ModPagespeedMessageBufferSize is the maximum number of bytes you would<br />
    # like to dump to your /mod_pagespeed_message page at one time,<br />
    # its default value is 100k bytes.<br />
    # Set it to 0 if you want to disable this feature.</p>
<p>    ModPagespeedMessageBufferSize 100000</p>
<p>    # mod_pagespeed has the ability to collect statistics about page visits as<br />
    # well as page, resource, and div location (see div_structure_filter)<br />
    # referrals.  These will eventually be used to speed up pages with at least<br />
    # resource pre-fetch, if not Chrome's new pre-render, technology.  See<br />
    # googlewebmastercentral.blogspot.com/2011/06/announcing-instant-pages.html<br />
    #   We recommend enabling the div_structure filter if turning on statistics<br />
    # collection below.  Enabling the div_structure filter will increase the<br />
    # effectiveness of pre-rendering prediction, because it will take into<br />
    # account both URLs and page locations when aggregating user click through<br />
    # behavior.  To enable the div_structure filter, uncomment the appropriate<br />
    # line below or add div_structure to the enabled filters at the top of this<br />
    # configuration file.<br />
    #   Page /mod_pagespeed_referer_statistics lets you view the accumulated<br />
    # referral statistics.<br />
    #   ModPagespeedCollectRefererStatistics on enables collection (default off)<br />
    #   ModPagespeedHashRefererStatistics obscures collected info (default off)<br />
    #   ModPagespeedRefererStatisticsOutputLevel can be changed if the page<br />
    # /mod_pagespeed_referer_statistics is slow to load:<br />
    #   - Organized (default) is the most readable and ordered logically, but<br />
    #       involves computation<br />
    #   - Simple is readable but unordered<br />
    #   - Fast is the fastest and contains all necessary information, but is<br />
    #       fairly unreadable</p>
<p>    # ModPagespeedCollectRefererStatistics on<br />
    # ModPagespeedHashRefererStatistics on<br />
    # ModPagespeedRefererStatisticsOutputLevel Simple<br />
    # ModPagespeedEnableFilters div_structure</p>
<p>    &lt;Location /mod_pagespeed_message&gt;<br />
        Allow from localhost<br />
        Allow from 127.0.0.1<br />
        SetHandler mod_pagespeed_message<br />
    &lt;/Location&gt;<br />
    &lt;Location /mod_pagespeed_referer_statistics&gt;<br />
        Allow from localhost<br />
        Allow from 127.0.0.1<br />
        SetHandler mod_pagespeed_referer_statistics<br />
    &lt;/Location&gt;<br />
&lt;/IfModule&gt;<br />
</code><br />
And then open /usr/local/apache/conf/includes/pre_main_global.conf and add:<br />
<code><br />
Include conf/pagespeed.conf<br />
</code></p>
<li>Rebuild Apache config and restart apache.</li>
<p><code><br />
/scripts/buildhttpdconf<br />
/etc/init.d/httpd restart<br />
</code>
</ol>
<p>That&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2012/04/13/installing-mod_pagespeed-on-a-cpanelwhm-server/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Increasing cPanel /tmp size</title>
		<link>http://hasaninter.net/2011/05/07/increasing-cpanel-tmp-size/</link>
		<comments>http://hasaninter.net/2011/05/07/increasing-cpanel-tmp-size/#comments</comments>
		<pubDate>Sun, 08 May 2011 04:43:31 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=50</guid>
		<description><![CDATA[By default, cPanel sets up a paltry]]></description>
				<content:encoded><![CDATA[<p>By default, cPanel sets up a paltry <512MB /tmp disk. This isn't nearly large enough for large file uploads or other disk-intensive purposes. While it's better to use RAM for temporary storage, sometimes you need a place to dump huge files (such as uploads). Luckily, raising the /tmp disk size has been fairly simple. cPanel's script to secure the /tmp partition against drop-in hacks by making it noexec can also resize the /tmp directory.</p>
<p>The file we'll be modifying is:</p>
<p><code><br />
/scripts/securetmp<br />
</code></p>
<p>Until recently, modifying one variable was enough to change this, but it seems like there was a change recently that has caused that method to no longer remount /tmp properly. Luckily, the fix for this is two additional small changes to the file.</p>
<p>Let's open up /scripts/securetmp in your favorite editor:</p>
<p><code><br />
nano /scripts/securetmp<br />
</code></p>
<p>First, we're going to modify line 49:</p>
<p><code><br />
my $auto = 1<br />
</code></p>
<p>If this isn't already set to 1, set it. Just makes things easier. Next, let's set the /tmp size, line 148:</p>
<p><code><br />
my $tmpdsksize = 2097152;<br />
</code></p>
<p>This size is in KB - 2GB aught to do it. Now, to fix the issue of mounting /tmp, line 289:</p>
<p><code><br />
system 'mount', '-o', $mountkeyword . ',loop,noexec,nosuid', $tmpmnt, '/tmp';<br />
</code></p>
<p>We're adding "loop," to the options passed to the mount command to ensure that the system understands /tmp is a loopback device being created on /usr/tmpDSK. Save and exit your file.</p>
<p>Next, we need to shut off anything using /tmp:</p>
<p><code><br />
/etc/init.d/mysql stop<br />
/etc/init.d/httpd stop<br />
</code></p>
<p>And unmount it and /var/tmp:</p>
<p><code><br />
umount /tmp<br />
umount /var/tmp<br />
</code></p>
<p>If you get errors, retry a few times, it'll usually unmount after the 2nd or 3rd try. If you're still getting errors, make sure nothing is open in /tmp:</p>
<p><code><br />
lsof | grep /tmp<br />
</code></p>
<p>Shut it down or delete it. Next, we need to remove the existing /tmp partition file:</p>
<p><code><br />
rm -f /usr/tmpDSK<br />
</code></p>
<p>And finally, create the new device:</p>
<p><code><br />
/scripts/securetmp<br />
</code></p>
<p>Depending on the size of your partition, this may take up to 15-20 minutes. After you're done, start everything back up and ensure /tmp is mounted and the right size with a simple:</p>
<p><code><br />
df -h<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/05/07/increasing-cpanel-tmp-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing New Plesk Components on Linux</title>
		<link>http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/</link>
		<comments>http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 01:40:47 +0000</pubDate>
		<dc:creator>Jordan Cooks</dc:creator>
				<category><![CDATA[Fixing Shit]]></category>
		<category><![CDATA[Installing Shit]]></category>
		<category><![CDATA[Plesk]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://hasaninter.net/?p=45</guid>
		<description><![CDATA[Installing New Components Ever been in a Plesk box but can&#8217;t find certain components, like ASP support, or the backup manager? This is because Plesk installs whatever you tell it to at the initial install, and only whatever you tell it to. This leads to a lot of missing components that you might be used <a href='http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<h1>Installing New Components</h1>
<p>Ever been in a Plesk box but can&#8217;t find certain components, like ASP support, or the backup manager? This is because Plesk installs whatever you tell it to at the initial install, and only whatever you tell it to. This leads to a lot of missing components that you might be used to having access to. Plesk won&#8217;t tell you anything in the GUI except that the component is not installed, so you must hunt down this binary:</p>
<p><code>/usr/local/psa/admin/bin/autoinstaller</code><br />
<br />This is the Plesk Autoinstaller, which will allow you, through its byzantine menu corridors, to find the gold that is the component you need. Navigating it is fairly simple, although you&#8217;ll probably want to read all of the text on the screen if this is your first time.</p>
<p>However, a more sinister condition awaits you &#8211; the fact that the Plesk autoinstaller apparently doesn&#8217;t know how to fucking resolve rpm dependencies. Why is it called an autoinstaller if it doesn&#8217;t automatically install anything extra? I don&#8217;t know.</p>
<h1>Resolving Plesk Component Dependencies</h1>
<p>Luckily, it&#8217;s not that difficult to resolve RPM dependency errors. Did you get an error message that looks something like this?</p>
<p><code><br />
Retrieving information about the installed packages...<br />
File downloading PSA_9.3.0/dist-rpm-CentOS-5-x86_64/build-9.3.0-cos5-x86_64.hdr.gz: 10%..20%..30%..40%..50%..60%..70%..80%..90%..100% was finished.<br />
File downloading PSA_9.3.0/update-rpm-CentOS-5-x86_64/update-9.3.0-cos5-x86_64.hdr.gz: 10%..20%..30%..40%..50%..60%..70%..80%..90%..100% was finished.<br />
File downloading PSA_9.3.0/thirdparty-rpm-CentOS-5-x86_64/thirdparty-9.3.0-cos5-x86_64.hdr.gz: 13%..25%..31%..40%..54%..60%..72%..83%..95%..100% was finished.<br />
Determining the packages that need to be installed.<br />
ERROR: Unable to install the "psa-backup-manager-9.3.0-cos5.build93091230.06.x86_64" package.<br />
Not all packages were installed.<br />
Please, contact product technical support.<br />
[root@host2 plesk]#</code><br />
<br />Not to worry! First, try Google to find that RPM &#8211; Plesk allows their FTP server to be directory indexed, so it shouldn&#8217;t be hard to find the exact RPM it&#8217;s erroring out on. Try downloading the .rpm file and installing it manually using rpm -i:</p>
<p><code>wget http://autoinstall.swsoft.com.cn/PSA_9.3.0/dist-rpm-CentOS-5-x86_64/opt/backup/psa-backup-manager-9.3.0-cos5.build93091230.06.x86_64.rpm<br />
rpm -i psa-backup-manager-9.3.0-cos5.build93091230.06.x86_64.rpm</code></p>
<p>If all goes well, you&#8217;ll get output messages listing the failed dependencies. Ignore any Plesk-looking dependencies, the auto-installer actually fixes these. Use yum to install any other system packages you may need.</p>
]]></content:encoded>
			<wfw:commentRss>http://hasaninter.net/2011/04/09/installing-new-plesk-components-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
