<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux Sysadmin Blog &#187; cpanel</title>
	<atom:link href="http://linuxsysadminblog.com/category/cpanel/feed/" rel="self" type="application/rss+xml" />
	<link>http://linuxsysadminblog.com</link>
	<description></description>
	<lastBuildDate>Tue, 10 May 2011 03:23:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>HowTo Install APC on CPanel/WHM</title>
		<link>http://linuxsysadminblog.com/2011/05/howto-install-apc-on-cpanelwhm/</link>
		<comments>http://linuxsysadminblog.com/2011/05/howto-install-apc-on-cpanelwhm/#comments</comments>
		<pubDate>Fri, 06 May 2011 02:07:16 +0000</pubDate>
		<dc:creator>Marius</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[whm]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1338</guid>
		<description><![CDATA[CPanel includes support in their installer for eaccelerator; still, for some strange reason they don&#8217;t include support for APC also. So, if you want to install APC on your CPanel powered server, you will have to go back at the command line and install it manually. Here are the steps needed to install the latest [...]]]></description>
			<content:encoded><![CDATA[<p><strong>CPanel</strong> includes support in their installer for <strong>eaccelerator</strong>; still, for some strange reason they don&#8217;t include support for <strong><a href="http://pecl.php.net/package/APC" target="_blank">APC</a></strong> also. So, if you want to install APC on your CPanel powered server, you will have to go back at the command line and install it manually.</p>
<p>Here are the steps needed to install the latest version of APC (3.1.8 at the time of writing this article; please check for the latest version available when you are reading this and make the changes accordingly):<br />
<code>cd /usr/local/src<br />
wget http://pecl.php.net/get/APC-3.1.8.tgz<br />
tar -zxvf APC-3.1.8.tgz<br />
cd APC-3.1.8<br />
phpize<br />
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/bin/php-config<br />
make<br />
make install</code></p>
<p>Next, activate the apc module in <strong>php.ini</strong> by adding something like this:<br />
<code>extension="apc.so"<br />
apc.enabled=1<br />
apc.shm_segments=1<br />
apc.shm_size=128</code></p>
<p>Finally, you will have to <em>restart apache</em> and after that the APC module should be activated and in use. Hopefully, this will help you enable APC on your CPanel server in some very simple steps in less that 5minutes.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2011/05/howto-install-apc-on-cpanelwhm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Subversion (SVN) and mod_dav_svn on Cpanel Server</title>
		<link>http://linuxsysadminblog.com/2010/10/setup-subversion-svn-and-mod_dav_svn-on-cpanel-server/</link>
		<comments>http://linuxsysadminblog.com/2010/10/setup-subversion-svn-and-mod_dav_svn-on-cpanel-server/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 11:00:06 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[dav]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=1180</guid>
		<description><![CDATA[Quick install guide for SVN with mod_dav_svn (http/https) repository access on Cpanel server running CentOs5. Configure Cpanel for SVN Recompile Apache/PHP (WHM -&#62; Software -&#62; EasyApache) and enable support for the following: Dav (Among other things mod_dav can be used by DAV enabled Frontpage clients instead of FP extensions) BerkeleyDB. Note: BerkeleyDB support (&#8220;&#8211;with-berkeley-db&#8220;) is [...]]]></description>
			<content:encoded><![CDATA[<p>Quick install guide for SVN with mod_dav_svn (http/https) repository access on Cpanel server running CentOs5.</p>
<p><strong>Configure Cpanel for SVN</strong><br />
Recompile Apache/PHP (<em>WHM -&gt; Software -&gt; EasyApache</em>) and enable support for the following:</p>
<ul>
<li> Dav (<em>Among other things mod_dav can be used by DAV enabled Frontpage clients instead of FP extensions</em>)</li>
<li> BerkeleyDB.  <strong>Note</strong>: BerkeleyDB support (&#8220;<em>&#8211;with-berkeley-db</em>&#8220;) is not enabled by default in EasyApache so you need to add this manually to your EasyApache config using <a href="http://docs.cpanel.net/twiki/bin/view/EasyApache3/CustomConfigureFlags">this guide</a> or <a href="http://community.eapps.com/showthread.php?271-Adding-subversion-support-to-Apache">this one</a>.</li>
</ul>
<p><strong>Install Subversion and mod_dav_svn</strong><br />
Install subversion using yum (<em>yum install subversion</em>) or install it from source.  At this time CentOS repo version is 1.4.x and the latest from source is 1.6.x.<br />
<span id="more-1180"></span><br />
<strong>Install and enable mod_dav_svn in Cpanel</strong><br />
Install mod_dav_svn using yum (<em>yum install mod_dav_svn</em>) &#8211; version 1.4.x same as subersion above.<br />
Load mod_dav_svn module to Apache.  Go to <em>WHM -&gt; Service Configuration -&gt; Apache Configuration -&gt; Include Editor -&gt; Pre-Main Include</em>.   Select either &#8220;<em>All Versions</em>&#8221; or your current Apache version (ex: &#8220;<em>2.2.16</em>&#8220;) from drop-down list.  Or you can edit their corresponding file directly:<br />
All Versions:  <em>/usr/local/apache/conf/includes/pre_main_global.conf</em><br />
Apache 2.2.16: <em>/usr/local/apache/conf/includes/pre_main_2.conf</em><br />
Add the codes below and click &#8220;<em>Update</em>&#8221; button to save config. This will restart Apache if no error on your configuration.<br />
<code>&lt;IfModule mod_dav.c&gt;<br />
LoadModule dav_svn_module /usr/lib/httpd/modules/mod_dav_svn.so<br />
LoadModule authz_svn_module /usr/lib/httpd/modules/mod_authz_svn.so<br />
&lt;/IfModule&gt;</code></p>
<p><strong>Create repository and add http access (ex: http://domain.com/svn)</strong><br />
Create your repository: <em>svnadmin create /path/to/svn/repos</em><br />
Add the code below to your domain&#8217;s custom include file.  You need to create this file based on <a href="http://www.cpanel.net/documentation/easyapache/customdirectives.html">this guide</a> to preserve when you recompile Apache/PHP.<br />
Example file (Apache2,standard/non-ssl):  <em>/usr/local/apache/conf/userdata/std/2/cpanl_user/domain.com/svn.conf</em><br />
File Contents:<br />
<code>&lt;Location /svn&gt;<br />
#  mod dav svn support and location of svn repo files<br />
DAV svn<br />
SVNPath /path/to/svn/repos<br />
# authentication for security, create using htpasswd<br />
AuthType Basic<br />
AuthName "SVN Access"<br />
AuthUserFile /path/to/file/containing/user.pass<br />
Require valid-user<br />
# added for permissions/access<br />
Order allow,deny<br />
Allow from all<br />
&lt;/Location&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2010/10/setup-subversion-svn-and-mod_dav_svn-on-cpanel-server/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>enabling allow_url_include locally in cPanel</title>
		<link>http://linuxsysadminblog.com/2009/07/enabling-allow_url_include-locally-in-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2009/07/enabling-allow_url_include-locally-in-cpanel/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 17:44:44 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=803</guid>
		<description><![CDATA[When using cPanel the way to enable allow_url_include directive locally (per user) is to create an Virtual Host include: First create an include file: /usr/local/apache/conf/userdata/std/2/username/domain.com/custom.conf Add directive to custom.conf: php_admin_flag allow_url_include On Then run to enable include: /scripts/ensure_vhost_includes --user=username --verbose Alternatively, enabling allow_url_include globally (server-wide) is done by editing /usr/local/lib/php.ini and adding &#8220;allow_url_include = On&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>When using cPanel the way to enable allow_url_include directive locally (per user) is to create an <strong>Virtual Host include</strong>:</p>
<p>First create an include file:<br />
<code>/usr/local/apache/conf/userdata/std/2/username/domain.com/custom.conf</code></p>
<p>Add directive to custom.conf:<br />
<code><IfModule mod_php5.c><br />
php_admin_flag allow_url_include On<br />
</Ifmodule></code></p>
<p>Then run to enable include:<br />
<code>/scripts/ensure_vhost_includes --user=username --verbose</code></p>
<p>Alternatively, enabling allow_url_include globally (server-wide) is done by editing /usr/local/lib/php.ini and adding  &#8220;allow_url_include = On&#8221; directive to the Fopen wrapper section.<br />
<code>;;;;;;;;;;;;;;;;;;<br />
; Fopen wrappers ;<br />
;;;;;;;;;;;;;;;;;;</code>                                                                                                                                           </p>
<p><code>;Whether to allow the treatment of URLs (like http:// or ftp://) as files.<br />
allow_url_fopen = On<br />
<strong>allow_url_include = On</strong></code></p>
<p>and restarting apache by issuing &#8220;service httpd restart&#8221; command as root.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/07/enabling-allow_url_include-locally-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install GNUPG PHP extension in Cpanel</title>
		<link>http://linuxsysadminblog.com/2009/05/install-gnupg-php-extension-in-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2009/05/install-gnupg-php-extension-in-cpanel/#comments</comments>
		<pubDate>Thu, 21 May 2009 09:20:35 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[gnupg]]></category>
		<category><![CDATA[gpg]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[pecl]]></category>
		<category><![CDATA[php extension]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=674</guid>
		<description><![CDATA[Here&#8217;s my quick howto on installing GNUPG PHP Pecl extension (pecl docs) in Cpanel. Please note that this covers only the installation process and no further details on setting up gpg keys or using the function with extension or sample PHP scripts. Installation process is very straightforward provided you met the requirements like php-pear, gnupg, [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my quick howto on installing <a href="http://us2.php.net/manual/en/book.gnupg.php">GNUPG</a> PHP Pecl extension (<a href="http://pecl.php.net/package/gnupg/docs">pecl docs</a>) in Cpanel.  Please note that this covers only the installation process and no further details on setting up gpg keys or using the function with extension or sample PHP scripts.</p>
<p>Installation process is very straightforward provided you met the requirements like php-pear, gnupg, libgpg-error, and gpgme.  You can install it directly from WHM -> Module Installers -> PHP Pecl, enter &#8216;<em>gnupg</em>&#8216; and click the Install button.  You can do the same via shell with this command &#8216;<em>pecl install gnupg</em>&#8216;.  Then restart your Apache.  Be sure to double check if the extension was added to you <em>php.ini</em>.<br />
<span id="more-674"></span><br />
On Cpanel servers most of the requirements are present, like <em>php-pear</em> (if you compiled your apache/php with pear), <em>gnupg, libgpg-error</em>, etc, except for <a href="http://www.gnupg.org/gpgme.html"><em>gpgme</em></a> which is the main library used by <em>gnupg</em> extension.  Our system is running CentOS 4.7 with latest STABLE branch of Cpanel (S35075 at this time of writing), PHP 5.2.9 with pear and libgpg-error (version 1.0-1 only).  Only missing requirement was <em>gpgme</em> which i installed from source as it was not available on our default yum repository.  You can also install it from other repositories like <em>centos.karan.org</em>.  At this time the latest <em>gpgme</em> version is <a href="http://www.gnupg.org/download/index.en.html#gpgme">1.1.8</a> but I installed version 1.1.2 because it&#8217;s the latest version compatible with our libgpg.</p>
<p>I also encountered an error library path when I check the extension, <code>"error while loading shared libraries: libgpgme.so.11: cannot open shared object file: No such file or directory"</code>, so I had to add &#8216;<em>/usr/local/lib</em>&#8216; to <em>/etc/ld.so.conf</em> and run <em>ldconfig</em>, so that libraries in this directory are detected automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/install-gnupg-php-extension-in-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>umask &#8216;ing apache under cPanel</title>
		<link>http://linuxsysadminblog.com/2009/05/umask-ing-apache-under-cpanel/</link>
		<comments>http://linuxsysadminblog.com/2009/05/umask-ing-apache-under-cpanel/#comments</comments>
		<pubDate>Thu, 14 May 2009 23:17:02 +0000</pubDate>
		<dc:creator>max</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[umask]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=644</guid>
		<description><![CDATA[Ran into an issue today where a php created file was unreadable by other users or services that run under a different user. Since this is a software originated issue the sysadmin would love for the developer to change the code to include the chmod() php function to set permission to 644 after file creation. [...]]]></description>
			<content:encoded><![CDATA[<p>Ran into an issue today where a php created file was unreadable by other users or services that run under a different user.  Since this is a software originated issue the sysadmin would love for the developer to change the code to include the <a href="http://us2.php.net/chmod">chmod() php function</a>  to set permission to 644 after file creation.  On the flip side when a developer sees &#8220;permission&#8221; they automatically assume it&#8217;s OS related and want the sysadmin to resolve the issue. <span id="more-644"></span></p>
<p>This time I let the developer slide and implemented a fix on system end by appending <code lang="apache">umask 022</code> into /usr/local/apache/bin/envvars file and restarting apache. This will apply a umask of 022 to the default perrmission of 666 for newly created files. The result is that anytime apache creates a file be it via php or another way it will always have 644 permissions and will be world readable.<br />
But wait the fun doesn&#8217;t end there as we are running cPanel on this particular server and this env change will be lost next time Apache is rebuilt via <a href="http://www.cpanel.net/documentation/easyapache/ea3custom_modvar.html">EasyApache</a>. To make this change persistent create a file called umask with the digits 022 as contents in /var/cpanel/easy/apache/rawenv/</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/umask-ing-apache-under-cpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install ImageMagick and Imagick on Cpanel Server</title>
		<link>http://linuxsysadminblog.com/2009/05/install-imagemagick-and-imagick-on-cpanel-server/</link>
		<comments>http://linuxsysadminblog.com/2009/05/install-imagemagick-and-imagick-on-cpanel-server/#comments</comments>
		<pubDate>Tue, 12 May 2009 16:51:25 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[php extension]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=621</guid>
		<description><![CDATA[Here&#8217;s a quick how-to for installing ImageMagick and Imagick on Cpanel server. I will cover only the procedure using the Cpanel built-in scripts, although you can also install it the usual way (rpm or source install). ImageMagick is the application for working with images while the Imagick is a PHP extention to modify/create images using [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick how-to for installing <strong><a href="http://www.imagemagick.org/script/index.php">ImageMagick</a></strong> and <strong><a href="http://pecl.php.net/package/imagick">Imagick</a></strong> on Cpanel server.  I will cover only the procedure using the Cpanel built-in scripts, although you can also install it the usual way (rpm or source install).  <a href="http://www.imagemagick.org/script/index.php">ImageMagick</a>  is the application for working with images while the <a href="http://pecl.php.net/package/imagick">Imagick</a> is a PHP extention to modify/create images using the ImageMagick API.  </p>
<p><strong>Installation:</strong></p>
<p><strong>ImageMagick</strong><br />
  Check first if it&#8217;s installed:<br />
  <code lang="bash">/scripts/checkimagemagick</code><br />
  Proceed with Installation:<br />
  <code lang="bash">/scripts/installimagemagick</code><br />
  Installation will take a couple minutes as it will install other packages needed by ImageMagick.  After the installation, you can check your ImageMagick version:<br />
  <code lang="bash">/usr/bin/convert --version</code><br />
  It will give you something like:<br />
  <em>Version: ImageMagick 6.4.8 2009-05-11 Q16 OpenMP http://www.imagemagick.org<br />
  Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC</em><br />
<span id="more-621"></span><br />
<strong>Imagick</strong><br />
  Go to <strong>WHM -> Software -> Module Installers -> PHP Pecl </strong>(manage). On the box below &#8220;<strong>Install a PHP Pecl</strong>&#8221; enter &#8220;<strong>imagick</strong>&#8221; and click &#8220;<strong>Install Now</strong>&#8221; button &#8211; that&#8217;s all.  </p>
<p>Restart Apache and check your <em><strong>phpinfo</strong></em> page to see the details of Imagick and ImageMagick as well.  See linked images for reference:  <a href="http://linuxsysadminblog.com/wp-content/uploads/2009/05/install.jpg">image1</a>, <a href="http://linuxsysadminblog.com/wp-content/uploads/2009/05/installed.jpg">image2</a>.</p>
<p><strong>Uninstall:</strong></p>
<p>If you decide to uninstall it&#8217;s as easy as the installation process:<br />
ImageMagick: <code lang="bash"> /scripts/cleanimagemagick</code><br />
Imagick:  <strong>WHM -> Software -> Module Installers -> PHP Pecl</strong> (manage). Click on <strong>Uninstall</strong> button for Imagick.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/install-imagemagick-and-imagick-on-cpanel-server/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>CSF Not Detecting POP3 Login Failures</title>
		<link>http://linuxsysadminblog.com/2009/05/csf-not-detecting-pop3-login-failures/</link>
		<comments>http://linuxsysadminblog.com/2009/05/csf-not-detecting-pop3-login-failures/#comments</comments>
		<pubDate>Thu, 07 May 2009 09:22:56 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[csf]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=612</guid>
		<description><![CDATA[This is the second time that CSF on our Cpanel server is not detecting POP3 login failures from a dictionary attack. The IP address was added on the ip deny list but still it was able to attempt to login on POP3. We have our LF_POP3D set to 20 and LF_POP3D_PERM to 1 to block [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second time that <a href="http://configserver.com/cp/csf.html">CSF</a> on our Cpanel server is not detecting POP3 login failures from a dictionary attack.  The IP address was added on the ip deny list but still it was able to attempt to login on POP3.  We have our LF_POP3D set to 20 and LF_POP3D_PERM to 1 to block the ip permanently after 20 tries.  I can&#8217;t remember the CSF version when this first happened, but this time we&#8217;re running CSF version 4.65 and the latest is 4.67.  Of course, the usual way for me to fix the issue is to upgrade to the latest version.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/05/csf-not-detecting-pop3-login-failures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Hostname of Cpanel Server</title>
		<link>http://linuxsysadminblog.com/2009/04/change-hostname-of-cpanel-server/</link>
		<comments>http://linuxsysadminblog.com/2009/04/change-hostname-of-cpanel-server/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 12:19:16 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[cpanel]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=498</guid>
		<description><![CDATA[This task is very simple and can be done in two steps: 1.)  Login as root and change your server hostname: hostname newhos.name.tld Note: Don&#8217;t forget to create an A entry for your new hostname, otherwise you will get a popup message during WHM login. 2.)  Issue /usr/local/cpanel/cpkeyclt to update your Cpanel License Key, otherwise [...]]]></description>
			<content:encoded><![CDATA[<p>This task is very simple and can be done in two steps:<br />
1.)  Login as root and change your server hostname:</p>
<p style="padding-left: 30px;"><code><em><strong>hostname newhos.name.tld</strong></em></code></p>
<p><strong>Note:</strong>  Don&#8217;t forget to create an A entry for your new hostname, otherwise you will get a popup message during WHM login.</p>
<p>2.)  Issue <code><em><strong>/usr/local/cpanel/cpkeyclt</strong></em></code> to update your Cpanel License Key, otherwise you will get Invalid License when you login to WHM/Cpanel interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2009/04/change-hostname-of-cpanel-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cpanel:  Adding custom configuration to httpd.conf</title>
		<link>http://linuxsysadminblog.com/2008/11/cpanel-adding-custom-configuration-to-httpdconf/</link>
		<comments>http://linuxsysadminblog.com/2008/11/cpanel-adding-custom-configuration-to-httpdconf/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 14:39:23 +0000</pubDate>
		<dc:creator>gerold</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=126</guid>
		<description><![CDATA[Recently, Cpanel implemented their standard way of adding custom changes to virtualhost configuration to preserve custom changes after an upgrade or Apache rebuild. Here are the two common situations of adding custom changes: 1.)  Changes added inside a &#60;VirtualHost&#62; This is very simple as we only need to create a single file that will contain [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Cpanel implemented their standard way of adding custom changes to virtualhost configuration to preserve custom changes after an upgrade or Apache rebuild.</p>
<p>Here are the two common situations of adding custom changes:</p>
<p><strong>1.)  Changes added inside a &lt;VirtualHost&gt;</strong><br />
This is very simple as we only need to create a single file that will contain our changes.  But we need to understand the correct location on where to place this file so that our changes will be read properly.</p>
<p><span id="more-126"></span></p>
<p>There are several cases of adding these changes and below are some samples and the coresponding directory where to put them:</p>
<p>- One virtualhosts (either SSL or standard)<br />
Apache1/SSL:  <em>/usr/local/apache/conf/userdata/ssl/1/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em><br />
Apache1/Standard:   <em>/usr/local/apache/conf/userdata/std/1/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em><br />
Apache2/SSL:   <em>/usr/local/apache/conf/userdata/ssl/2/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em><br />
Apache2/SSL:   <em>/usr/local/apache/conf/userdata/std/2/&lt;cpanel_user&gt;/&lt;domain&gt;/&lt;filename&gt;.conf</em></p>
<p>-  All virtualhosts (both SSL and standard)<br />
Apache 1/2:   <em>/usr/local/apache/conf/userdata/&lt;something&gt;.conf</em></p>
<p>-  All SSL virtualhost or all Standard virtualhost<br />
Apache 1/2 &#8211; all SSL:  <em>/usr/local/apache/conf/userdata/ssl/&lt;filename&gt;.conf</em><br />
Apache 1/2 &#8211; all Standard:   <em>/usr/local/apache/conf/userdata/std/&lt;filename&gt;.conf</em></p>
<p>* If you need to put the above changes on a specific Apache version you can put them this way:<br />
Apache 1 &#8211; all SSL:   <em>/usr/local/apache/conf/userdata/ssl/1/&lt;filename&gt;.conf</em><br />
Apache 2 &#8211; all Standard:  <em>/usr/local/apache/conf/userdata/std/2/&lt;filename&gt;.conf</em></p>
<p>The same process is followed on subdomains, like on one of my implementation i added a custom virtualhost in a subdomain to take effect on standard (http), so i put it on this directory:<br />
<em>/usr/local/apache/conf/userdata/ssl/2/gerold/mysubdomain.gerold.com/custom.conf</em>.</p>
<p>Take note that you also need to create the directories like &#8220;ssl&#8221;, &#8220;std&#8221;, &#8220;1&#8243;, &#8220;2&#8243;, or &#8220;mysubdomain.gerold.com&#8221; in order to have the correct directory structure/path.</p>
<p>You can verify if your custom changes were added correctly using this command:<br />
<strong><em>/scripts/verify_vhost_includes</em></strong></p>
<p>Then, update the include files:<br />
For changes concerning single account/user you can use this command:<br />
<strong><em> /scripts/ensure_vhost_includes &#8211;user=&lt;username&gt;</em></strong><br />
And for all users run:<br />
<strong><em>/scripts/ensure_vhost_includes &#8211;all-users</em></strong></p>
<p>And finally, restart Apache (<strong><em>/etc/init.d/httpd restart</em></strong>)</p>
<p><strong>2.)  Changes added outside a &lt;VirtualHost&gt;</strong></p>
<p>Adding custom changes outside of virtualhost can be done in different ways, like creating a templates or using the include editor.<br />
On my example, i will discuss using Include editor as i usually used this on some of our client sites.</p>
<p><strong>Cpanel have three ways to place our custom changes using Include editor, these are:</strong><br />
- <strong>Pre-Main Include</strong> &#8211; this is placed at the top of the httpd.conf file<br />
Location:  <em>/etc/httpd/conf/includes/pre_main_1.conf</em><br />
- <strong>Pre-VirtualHost Include</strong> &#8211; codes in this file are added before the first Vhost configuration<br />
Location:  <em>/etc/httpd/conf/includes/pre_virtualhost_1.conf</em><br />
- <strong>Post-VirtualHost Include</strong> &#8211; codes in this file are added at the end of httpd.conf<br />
Location:  <em>/etc/httpd/conf/includes/post_virtualhost_1.conf</em></p>
<p>So to add our changes we can go to WHM:  <em>Main &gt;&gt; Service Configuration &gt;&gt; Apache Setup &gt;&gt; Include Editor</em>, and select where you want to place your custom changes (<em>pre-main, pre-vhost, or post-vhost</em>).<br />
You can also edit directly the files (<em>pre_main_1.conf, pre_virtualhost_1.conf, post_virtualhost_1.conf</em>) located at <em>/etc/httpd/conf/includes/</em>.<br />
Finally, restart Apache (<strong><em>/etc/init.d/httpd restart</em></strong>) for changes to take effect.</p>
<p><strong>NOTE: For complete referrence please refer to<a href="http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html"> Cpanel Docs</a>.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2008/11/cpanel-adding-custom-configuration-to-httpdconf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Server and backup woes</title>
		<link>http://linuxsysadminblog.com/2008/11/server-and-backup-woes/</link>
		<comments>http://linuxsysadminblog.com/2008/11/server-and-backup-woes/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 13:31:58 +0000</pubDate>
		<dc:creator>Pim</dc:creator>
				<category><![CDATA[cpanel]]></category>
		<category><![CDATA[Down Time]]></category>
		<category><![CDATA[hosting]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[reboot]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[rm]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[undelete]]></category>

		<guid isPermaLink="false">http://linuxsysadminblog.com/?p=101</guid>
		<description><![CDATA[Looking back it seems like most posts on this blog are helpful tips and not reports of problems we encountered. Not that we don&#8217;t have any problems but we mostly report our solutions instead of the actual problems. Of course now and again a problem comes along that doesn&#8217;t have a solution ready to copy-paste [...]]]></description>
			<content:encoded><![CDATA[<p>Looking back it seems like most posts on this blog are helpful tips and not reports of problems we encountered. Not that we don&#8217;t have any problems but we mostly report our solutions instead of the actual problems. Of course now and again a problem comes along that doesn&#8217;t have a solution ready to copy-paste into a blog post. A week ago a wrong modification in a shell script resulted in the deletion of a good number of files before we caught it. The command below ended up being run with 2 empty variables:</p>
<p><code>rm -fr ${DIR}/${SUBDIR}</code></p>
<p><em>Hint: add the following alias for all users to prevent this: alias rm=&#8217;rm &#8211;preserve-root&#8221;</em></p>
<p>We were lucky in two ways. First off, this was not a production server, just a development and testing server and secondly the databases and web sites on that server were unaffected. That&#8217;s where the good news ended and Murphy&#8217;s Law kicked in. A couple of days before we found that our backup server had a corrupt filesystem on its RAID array. Since we did not have enough space available on other servers to place all the backups on other servers we temporarily suspended (you guessed it) the backups of the development and testing server.</p>
<p><span id="more-101"></span></p>
<h3>To undelete or not to undelete</h3>
<p>To get back up and running we immediately closed off access to the server and considered how we could recover the deleted files. Unfortunately undeleting files on an ext3 file system can only be done under certain circumstances. If the deleted files are still opened by some process the lsof utility can help as is documented on some web sites (just Google &#8220;ext3 undelete lsof&#8221;) but for larger scale undeletes the first step is to create an image of the partition in question. That image can then be searched for inode entries which can be very useful for finding specific files. However, if you want perform a more general undelete this method is a lot less useful because the file names will not be recovered.</p>
<p>Apart from the limited usefulness that creating this image would yield it would have taken several hours to complete during which development and testing would be at a standstill. We decided not to do this and instead take our losses instead. It is important to note what data we were losing at that point. Among the missing directories were some binary directories (/usr/sbin and such) which were easily recoverable by copying them from similarly configured servers. The most important missing data was the version control repository and a custom scripts directory. All the history of changes in the repository was lost but the latest state of the code was easily restored. We copied the latest code from the developer who had last performed a complete update (which is a part of the daily development process) and put that code into the repository again. Since the versions did not match up anymore after that (all code versions were reinitialized) all developers had to retrieve the complete set of code files again and copy their latest versions over it to keep working.</p>
<p>Although this is definitely a loss for us the impact is limited by the fact that we keep copies of all released code. These copies were unaffected on the server in question but are also present on other servers. If need be we can go through that history to track down a change, but the comments are gone and it&#8217;s not a process the developers can do themselves.</p>
<h3>Rebooting the server</h3>
<p>After all this we were left with one task, rebooting that server. Since we did not know exactly what got deleted this might give us some severe problems. This was scheduled for a quiet night with several system admins present. Unfortunately our hand was forced when a change in the iptables configuration caused a kernel panic. Rebooting the server revealed several more problems, the main one being the privileges on the /tmp directory. This resulted in Apache not being able to write session info there and MySQL not being able to write temporary data either. This was quickly solved of course. Without going into too many details the final action we took was to update our Cpanel. This reinstalled many missing scripts and binaries.</p>
<p>I bet you&#8217;re wondering why we don&#8217;t use off site backups. Well, we do actually. The problem is that this involves copying many gigabytes over a limited line so we made a selection of what needed to be copied and we focused mainly on all our production servers. The main purpose of our off site backups is to recover production servers in case our data center becomes unavailable.</p>
<h3>Conclusions</h3>
<p>It&#8217;s been an annoying experience and it&#8217;s hard to draw positive lessons from mr. Murphy&#8217;s teachings but all in all it could have been a lot worse. Production was not down or affected and even testing and development impact was pretty limited. The main things on our agenda after this are to review our backup strategy for essential locations and reviewing the use of root privileges on our servers. Although we use non-root users most of the time there are tasks that are made a lot quicker by changing to root. We all know the danger of this and need to be a lot more aware of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://linuxsysadminblog.com/2008/11/server-and-backup-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

