<?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>RedHatVN Network &#187; Directadmin</title>
	<atom:link href="http://redhatvn.net/category/linux/directadmin/feed" rel="self" type="application/rss+xml" />
	<link>http://redhatvn.net</link>
	<description>Shared Linux problems</description>
	<lastBuildDate>Mon, 31 Oct 2011 07:10:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>reconfigure CPAN module preferences</title>
		<link>http://redhatvn.net/reconfigure-cpan-module-preferences</link>
		<comments>http://redhatvn.net/reconfigure-cpan-module-preferences#comments</comments>
		<pubDate>Tue, 20 Sep 2011 03:58:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=1620</guid>
		<description><![CDATA[The first time you use the Perl module CPAN, a script is executed in order to properly configure several options (like the location of tar, gzip and unzip files, the cache size for the build directory, etc). If you want to modify these configuration options at a later time, you can do it in 2 [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/reconfigure-cpan-module-preferences"></g:plusone></div><p>The first time you use the Perl module CPAN, a script is executed in order to properly configure several options (like the location of tar, gzip and unzip files, the cache size for the build directory, etc).</p>
<p>If you want to modify these configuration options at a later time, you can do it in 2 ways:</p>
<p><strong>- Manually, modifying the configuration files</strong></p>
<p>You can either modify the user-specific file (usually ~/.cpan/CPAN/MyConfig.pm) or the system-wide configuration file (stored somewhere in the perl module directory tree, look for a directory named CPAN that holds a file named Config.pm)<br />
<span id="more-1620"></span><br />
<strong>- Automatically, using the CPAN module</strong></p>
<p>To do this, execute the following:</p>
<p><code>perl -MCPAN -e shell</code></p>
<p>When you&#8217;re in the cpan shell, execute:</p>
<p><code>cpan&gt; o conf init</code></p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/reconfigure-cpan-module-preferences/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Python2.6, mod_wsgi, and Python-MySQL on a CentOS box</title>
		<link>http://redhatvn.net/installing-python2-6-mod_wsgi-and-python-mysql-on-a-centos-box</link>
		<comments>http://redhatvn.net/installing-python2-6-mod_wsgi-and-python-mysql-on-a-centos-box#comments</comments>
		<pubDate>Mon, 31 Oct 2011 07:10:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=1632</guid>
		<description><![CDATA[UPDATED: January 31st, 2011: Python 2.6 now is in the normal EPEL repositories. There are some changes in the explanations below I’ve always hated Centos, probably because I’ve never been in a situation where I had to deal with the network security (other than the obvious stuff to ward off cross-site-scripting attacks and the such). [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/installing-python2-6-mod_wsgi-and-python-mysql-on-a-centos-box"></g:plusone></div><p>UPDATED: January 31st, 2011: Python 2.6 now is in the normal EPEL repositories. There are some changes in the explanations below</p>
<p>I’ve always hated Centos, probably because I’ve never been in a situation where I had to deal with the network security (other than the obvious stuff to ward off cross-site-scripting attacks and the such). Of course, that being the case, I did wind up dealing with CentOS at work and I had to get Django, Python 2.6 and the such functional.</p>
<p>Centos throws a few curveballs your way.. YUM is built on Python 2.4, and upgrading to a newer version supposedly breaks the program. Going back to Python 2.4 was not an option, mainly because all my python experience is on Python 2.5 / 2.6, and I don’t want to go back and learn an older non-maintained version of the language for a server. On the other hand, I didn’t want to lobby to just install Ubuntu.</p>
<p>This assumes you already have a normal LAMP setup. Furthermore, I’m assuming you do not have mod_python installed. This threw me for a loop for the longest time, so take this for what its worth.</p>
<p>The VERY FIRST STEP (if you are running a clean install of CentOS) is to get the dev tools installed.<br />
<span id="more-1632"></span><br />
<code><br />
# sudo yum groupinstall 'Development Tools'<br />
</code></p>
<p>After that, install Python 2.6 (or anything else newer in the 2.x series). As of January 31st, these are in the EPEL repositories; if you don’t have the EPEL repositories enabled, do the following:</p>
<p><code><br />
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm<br />
# yum repolist<br />
</code></p>
<p>Once that’s done, run yum update to get everything setup, and then install Python &amp; the MySQL dependencies (if they aren’t already installed)</p>
<p><code><br />
# yum install python26* mysql-devel mysql-server<br />
</code></p>
<p>This installs pretty much everything Python- &amp; MySQL-related that you need. You will need to run the following to get an extra piece of information:</p>
<p><code><br />
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)<br />
[GCC 4.4.3] on linux2<br />
Type "help", "copyright", "credits" or "license" for more information.<br />
&gt;&gt;&gt; import sys<br />
&gt;&gt;&gt; sys.prefix<br />
'/usr'<br />
</code></p>
<p>The prefix (/usr) is important for later. Set it aside and finish up.</p>
<p><code><br />
# cd ~<br />
# wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz/download<br />
# sudo tar xzvf MySQL-python-1.2.3.tar.gz<br />
# cd MySQL-python-1.2.3*<br />
# python26 setup.py install<br />
</code></p>
<p>(Don’t forget to create a user for use by Django in the database)</p>
<p><code><br />
# cd ~<br />
# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz<br />
# sudo tar xzvf mod_wsgi-3.3.tar.gz<br />
# cd mod_wsgi-3.3*<br />
# ./configure --with-python=/usr/bin/python2.6<br />
# make<br />
# make install<br />
</code></p>
<p>Now you need to fix up your Apache configuration. I won’t pretend to be an expert with WSGI (although I’ve managed to get it running on 3 different OSes running Apache), but make sure you include the following, somewhere near the Module block in the httpd.conf file.</p>
<p><code><br />
WSGIPythonHome /usr/<br />
</code></p>
<p>As long as you have this setup, and a proper WSGI script, you should be able to get up and running.</p>
<p>The Django installation is quite easy. Go into the Django source directory and type in</p>
<p><code># python2.6 setup.py install</code></p>
<p>That will take care of making sure Python2.6 also has access to django.</p>
<p>If you don’t want to install using the source code, you can also do this through pip. Follow the instructions <a href="http://blog.adlibre.org/technology/how-to-install-django-cms-on-centos-5-4-with-python-2-6.html">here</a> to install pip (while updating the version of pip to 0.8.2) and then type in</p>
<p><code># pip install django</code></p>
<p>That’s pretty much it. I’m sure there is something unclear, but I’ve got to get back to work -_-</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/installing-python2-6-mod_wsgi-and-python-mysql-on-a-centos-box/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configure Litespeed Webserver With PHP 5.3.0, Mail Header Patch and Suhosin Patch</title>
		<link>http://redhatvn.net/configure-litespeed-webserver-with-php-5-3-0-mail-header-patch-and-suhosin-patch</link>
		<comments>http://redhatvn.net/configure-litespeed-webserver-with-php-5-3-0-mail-header-patch-and-suhosin-patch#comments</comments>
		<pubDate>Thu, 27 Oct 2011 02:16:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Cpanel]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=1626</guid>
		<description><![CDATA[What is LiteSpeed Web Server ? LiteSpeed Web Server is the leading high-performance, high-scalability web server. It is completely Apache interchangeable so LiteSpeed Web Server can quickly replace a major bottleneck in your existing web delivery platform. With its comprehensive range of features and easy-to-use web administration console, LiteSpeed Web Server can help you conquer [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/configure-litespeed-webserver-with-php-5-3-0-mail-header-patch-and-suhosin-patch"></g:plusone></div><p>What is <strong>LiteSpeed Web Server</strong> ?</p>
<p><strong>LiteSpeed Web Server </strong>is the leading high-performance, high-scalability web server. It is completely Apache interchangeable so LiteSpeed Web Server can quickly replace a major bottleneck in your existing web delivery platform. With its comprehensive range of features and easy-to-use web administration console, LiteSpeed Web Server can help you conquer the challenges of deploying an effective web serving architecture.</p>
<p>In this tutorial we will upgrade current litespeed PHP to support PHP 5.3.0, Mail header patch and suhosin patch<br />
<span id="more-1626"></span><br />
What is <strong>Suhosin</strong> ?</p>
<p><strong>Suhosin</strong> is the big brother to the Hardened-PHP patch which adds an extra level of protection to PHP.</p>
<p>In this tutorial, i&#8217;ve tried to compile all packages from litespeed web server web interface but it&#8217;s failed.<br />
so i prefer to configured it manually.</p>
<p><strong>Download All Sources</strong></p>
<p>Login as root</p>
<p><code>#cd /root<br />
#wget <a title="http://uk.php.net/distributions/php-5.3.0.tar.gz" href="http://uk.php.net/distributions/php-5.3.0.tar.gz">http://uk.php.net/distributions/php-5.3.0.tar.gz</a><br />
#wget <a title="http://download.suhosin.org/suhosin-patch-5.3.0-0.9.8-BETA-1.patch.gz" href="http://download.suhosin.org/suhosin-patch-5.3.0-0.9.8-BETA-1.patch.gz">http://download.suhosin.org/suhosin-patch-5.3.0-0.9.8-BETA-1.patch.gz</a><br />
#wget <a title="http://choon.net/opensource/php/php-5.3.0-mail-header.patch" href="http://choon.net/opensource/php/php-5.3.0-mail-header.patch">http://choon.net/opensource/php/php-5.3.0-mail-header.patch</a><br />
#wget <a title="http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.10.tgz" href="http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.10.tgz">http://www.litespeedtech.com/packages/lsapi/php-litespeed-4.10.tgz</a><br />
#wget <a title="http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz" href="http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz">http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz</a></code></p>
<p><strong>Extract Packages</strong></p>
<p><code>#cd /root<br />
#tar -zxvf php-5.3.0.tar.gz<br />
#gunzip suhosin-patch-5.3.0-0.9.8-BETA-1.patch.gz<br />
#tar -zxvf autoconf-2.13.tar.gz<br />
</code><br />
<strong>Install autoconf</strong></p>
<p><code>#cd /root<br />
#cd autoconf-2.13<br />
#./configure &amp;&amp; make &amp;&amp; make install</code></p>
<p><strong>Compile PHP 5.3.0 with PHP mail header , Suhosin and PHP-Litespeed<br />
</strong></p>
<p><code>#cd /root<br />
#cd php-5.3.0</code></p>
<p><strong>Patching PHP mail header</strong> <strong>&amp; Suhosin</strong></p>
<p><code>#patch -p1 &lt; /root/php-5.3.0-mail-header.patch<br />
#patch -p1 &lt; /root/suhosin-patch-5.3.0-0.9.8-BETA-1.patch<br />
</code><br />
<strong>Exctract and Compile PHP-litespeed </strong></p>
<p><code>#cd /root<br />
#cp php-litespeed-4.10.tgz /root/php-5.3.0/sapi<br />
#tar -zxvf php-litespeed-4.10.tgz<br />
#cd /root/php-5.3.0<br />
#touch ac*<br />
#./buildconf --force</code></p>
<p><strong>Compile All </strong></p>
<p><code>#cd /root/php-5.3.0<br />
# ./configure --with-litespeed --prefix=/usr/local/lsws/lsphp5 --with-mysql --with-zlib --with-gd --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --enable-mbstring --with-iconv --with-mcrypt --with-curl --with-ftp --with-gettext --with-ttf --enable-suhosin --enable-gd-native-ttf --with-jpeg-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --with-kerberos --with-openssl --with-mhash --with-pcre-regex=/usr/local --with-pear --with-png-dir=/usr/local/lib --enable-zip -enable-bcmath --enable-calendar --with-mysqli=/usr/bin/mysql_config<br />
#make</code></p>
<p>If make is running successfully then stop here.</p>
<p><strong>Copy PHP Binary to litespeed fcgi-bin Directory</strong></p>
<p><code>#cd /usr/local/lsws/fcgi-bin<br />
#unlink lsphp5<br />
#cp /root/php-5.3.0/sapi/litespeed/php lsphp-5.3.0<br />
#ln -s ./lsphp-5.3.0 lsphp5</code></p>
<p><strong>Verify PHP Version </strong></p>
<p><code>#./lsphp5 -v<br />
PHP 5.3.0 with Suhosin-Patch (litespeed) (built: Sep 13 2009 22:29:50)<br />
Copyright (c) 1997-2004 The PHP Group<br />
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies</code></p>
<p><strong>If you see any error like below :</strong></p>
<p><code>#./lsphp5 -v</code><br />
PHP Warning:  PHP Startup: Unable to load dynamic library &#8216;/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/suhosin.so&#8217; &#8211; Cannot open &amp;quot;/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/suhosin.so&amp;quot; in Unknown on line 0PHP Warning:  PHP Startup: Unable to load dynamic library &#8216;/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/xcache.so&#8217; &#8211; Cannot open &amp;quot;/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626/xcache.so&amp;quot; in Unknown on line 0PHP 5.3.0 with Suhosin-Patch (litespeed) (built: Sep 13 2009 22:29:50)<br />
Copyright (c) 1997-2004 The PHP Group<br />
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies</p>
<p><strong>IMPORTANT :</strong><br />
This is mean you need to recompile XCACHE and SUHOSIN Packages.</p>
<p><strong>Restart Litespeed Webserver</strong></p>
<p><code>#/usr/local/lsws/bin/lswsctrl stop<br />
#/usr/local/lsws/bin/lswsctrl start</code></p>
<p><strong>Here is the PHPINFO result :</strong></p>
<p><strong><img src="http://www.wowtutorial.org/system/files/u2/php5.3.jpg" alt="" width="95%" /></strong></p>
<p>&nbsp;</p>
<p><strong><img src="http://www.wowtutorial.org/system/files/u2/php5.3%20suhosin.jpg" alt="" width="95%" /></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/configure-litespeed-webserver-with-php-5-3-0-mail-header-patch-and-suhosin-patch/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server monitoring using Munin in CentOS 5.6 + DirectAdmin</title>
		<link>http://redhatvn.net/server-monitoring-using-munin-in-centos-5-6-directadmin</link>
		<comments>http://redhatvn.net/server-monitoring-using-munin-in-centos-5-6-directadmin#comments</comments>
		<pubDate>Mon, 12 Sep 2011 08:53:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=1600</guid>
		<description><![CDATA[Download RPMForge Package. Check your system with uname -a command to get the suitable package. Below is the current one I got : 32-bit system: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm 64-bit system wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm If you want to check for the latest one, check it from -> http://packages.sw.be/ My instruction will base on x86_64 package. 2. Install GPG [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/server-monitoring-using-munin-in-centos-5-6-directadmin"></g:plusone></div><p>Download RPMForge Package. Check your system with <strong>uname -a</strong> command to get the suitable package. Below is the current one I got :</p>
<p>32-bit system:<br />
<code>wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm</code></p>
<p>64-bit system<br />
<code>wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm</code></p>
<p>If you want to check for the latest one, check it from -> http://packages.sw.be/</p>
<p>My instruction will base on x86_64 package.<br />
<span id="more-1600"></span><br />
2. Install GPG Key for DAG<br />
<code>rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt</code><br />
Verify the package<br />
<code>rpm -K rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm</code></p>
<p>After verification, install RPMForge package.<br />
<code>rpm -i rpmforge-release-0.5.2-2.el5.rf.x86_64.rp</code></p>
<p>Run command below : Basically, it will install Munin, set it to run at startup, start munin, create folder for munin to access through the web. (You can just copy and paste into your SSH)</p>
<p><code>yum install munin munin-node<br />
chkconfig –levels 235 munin-node on<br />
/etc/init.d/munin-node start<br />
chown -R munin:munin /var/www/munin<br />
ln -s /var/www/munin /var/www/html/munin<br />
service httpd restart &#038;&#038; service crond restart</code></p>
<p>That&#8217;s it. You may also want to protect your munin directory so that no one without password will not be able to access. What you have to do is</p>
<p><code>nano /var/www/html/munin/.htaccess</code></p>
<blockquote><p>AuthType Basic<br />
AuthName &#8220;Members Only&#8221;<br />
AuthUserFile /var/www/munin/.htpasswd</p>
<limit GET PUT POST>
require valid-user
</limit></blockquote>
<p>Then, save it.</p>
<p>7. Create .htpasswd file contains username and password to allow to access your munin (Here munin-admin is a username)</p>
<p><code>htpasswd -c /var/www/munin/.htpasswd munin-admin</code></p>
<p>Then enter your password and that&#8217;s it. Alternatively, if you don&#8217;t have htpasswd program on your server, you can just create .htpasswd file and put username and password in it. The password has to be encoded in MD5 format. (You can google and find any htpasswd generator. The format will be :</p>
<blockquote><p>username:password</p></blockquote>
<p>Troubleshoot : If there is no graph and you see /var/log/munin/munin-html.log like below</p>
<blockquote><p>Jul 24 11:50:10 &#8211; processing domain: localhost<br />
Jul 24 11:50:10 &#8211; processing node: localhost<br />
Jul 24 11:50:10 &#8211; processing service: apache_accesses<br />
Jul 24 11:55:11 &#8211; Starting munin-html, checking lock<br />
Jul 24 11:55:11 &#8211; could not copy style.css into htmldir<br />
Jul 24 11:55:11 &#8211; could not copy logo.png into htmldir<br />
Jul 24 11:55:11 &#8211; could not copy definitions.html into htmldir<br />
Jul 24 11:55:11 &#8211; processing domain: localhost<br />
Jul 24 11:55:11 &#8211; processing node: localhost<br />
Jul 24 11:55:11 &#8211; processing service: apache_accesses</p></blockquote>
<p>or error in /var/log/munin/munin-graph.log</p>
<blockquote><p>Jul 24 11:55:11 &#8211; Unable to graph /var/lib/munin/localhost/localhost-ntp_clock_nectec_or_th-jitter-g.rrd: Could not save png to &#8216;/var/www/munin/localhost/localhost-ntp_clock_nectec_or_th-year.png&#8217;<br />
Jul 24 11:55:11 &#8211; Graphed service : ntp_clock_nectec_or_th (0.08 sec * 4)<br />
Jul 24 11:55:11 &#8211; Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to &#8216;/var/www/munin/localhost/localhost-vmstat-month.png&#8217;<br />
Jul 24 11:55:11 &#8211; Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to &#8216;/var/www/munin/localhost/localhost-vmstat-week.png&#8217;<br />
Jul 24 11:55:11 &#8211; Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to &#8216;/var/www/munin/localhost/localhost-vmstat-day.png&#8217;<br />
Jul 24 11:55:11 &#8211; Unable to graph /var/lib/munin/localhost/localhost-vmstat-sleep-g.rrd: Could not save png to &#8216;/var/www/munin/localhost/localhost-vmstat-year.png&#8217;<br />
Jul 24 11:55:11 &#8211; Graphed service : vmstat (0.07 sec * 4)<br />
Jul 24 11:55:11 &#8211; Processed node: localhost (2.94 sec)<br />
Jul 24 11:55:11 &#8211; Processed domain: localhost (2.94 sec)<br />
Jul 24 11:55:11 &#8211; Munin-graph finished (2.95 sec)</p></blockquote>
<p>Then, check ownership of your munin file and directory. I got the problem with a directory (www) above munin directory. Original is :</p>
<blockquote><p>dr-xr-x&#8212; 10 webapps apache 4096 Jul 25 13:54 www</p></blockquote>
<p>I, then, have to chmod 755 /var/www to make it work. After I chmod it, below is what it will look like :</p>
<blockquote><p>drwxr-xr-x 10 webapps apache 4096 Jul 25 13:54 www</p></blockquote>
<p>Tested with :<br />
<em>CentOS 5.6 &#8211; 64 bits<br />
DirectAdmin 1.39.1 &#8211; With Custombuild 1.2<br />
PHP 5.3.6</em></p>
<p>Update : 2011.08.08<br />
You may want to use EPEL repository instead which will give you a newer version of Munin (1.4.5 vs 1.2.x). If you do, then, do the following :</p>
<p>Download EPEL repository<br />
<code>wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm</code><br />
Install it<br />
<code>rpm -Uvh epel-release-5-4.noarch.rpm</code><br />
Then, continue with step 5 above.</p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/server-monitoring-using-munin-in-centos-5-6-directadmin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Nginx as a reverse proxy for DirectAdmin</title>
		<link>http://redhatvn.net/use-nginx-as-a-reverse-proxy-for-directadmin</link>
		<comments>http://redhatvn.net/use-nginx-as-a-reverse-proxy-for-directadmin#comments</comments>
		<pubDate>Mon, 12 Sep 2011 08:59:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Directadmin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://redhatvn.net/?p=1602</guid>
		<description><![CDATA[I try to use Nginx as a reverse proxy to see if there is any improvement over Apache Worker MPM or not. I found an instruction from DirectAdmin webboard but it&#8217;s quite old. So, I just tried to follow their steps and do some modification to match what I have read. Below is what I [...]]]></description>
			<content:encoded><![CDATA[<div class="google_plus_one"><g:plusone size="medium" count="true" url="http://redhatvn.net/use-nginx-as-a-reverse-proxy-for-directadmin"></g:plusone></div><p>I try to use Nginx as a reverse proxy to see if there is any improvement over Apache Worker MPM or not. I found an instruction from DirectAdmin webboard but it&#8217;s quite old. So, I just tried to follow their steps and do some modification to match what I have read. Below is what I did</p>
<p>1. You need to compile Nginx. Nginx version 0.8.54 is the lastest stable release as of today. So, just copy and paste below code into your SSH<br />
<span id="more-1602"></span><br />
<code>wget http://sysoev.ru/nginx/nginx-0.8.54.tar.gz<br />
tar xvfz nginx-0.8.54.tar.gz<br />
cd nginx-0.8.54<br />
./configure --with-http_stub_status_module --with-http_gzip_static_module<br />
make<br />
make install</code></p>
<p>After installed, path related to Nginx is shown below : (Note that since you compile Nginx, there is no nginx.pid file there. You need to write it.)</p>
<p><code>nginx path prefix: "/usr/local/nginx"<br />
nginx binary file: "/usr/local/nginx/sbin/nginx"<br />
nginx configuration prefix: "/usr/local/nginx/conf"<br />
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"<br />
nginx pid file: "/usr/local/nginx/logs/nginx.pid"<br />
nginx error log file: "/usr/local/nginx/logs/error.log"<br />
nginx http access log file: "/usr/local/nginx/logs/access.log"<br />
nginx http client request body temporary files: "client_body_temp"<br />
nginx http proxy temporary files: "proxy_temp"<br />
nginx http fastcgi temporary files: "fastcgi_temp"<br />
nginx http uwsgi temporary files: "uwsgi_temp"<br />
nginx http scgi temporary files: "scgi_temp"</code></p>
<p>2. Edit configuration file:</p>
<p><code>nano -w /usr/local/nginx/conf/nginx.conf</code></p>
<p>Code is like below :</p>
<blockquote><p>user  apache apache;</p>
<p>worker_processes     4; # Set it according to what your CPU have. 4 Cores = 4<br />
worker_rlimit_nofile 8192;</p>
<p>pid /var/run/nginx.pid;</p>
<p>events {<br />
  worker_connections 1024;<br />
}  </p>
<p>http {<br />
    include       mime.types;<br />
    default_type  application/octet-stream;</p>
<p>    log_format main &#8216;$remote_addr &#8211; $remote_user [$time_local] &#8216;<br />
                    &#8216;&#8221;$request&#8221; $status  $body_bytes_sent &#8220;$http_referer&#8221; &#8216;<br />
                    &#8216;&#8221;$http_user_agent&#8221; &#8220;$http_x_forwarded_for&#8221;&#8216;;</p>
<p>    server_tokens off;<br />
    access_log  /var/log/nginx_access.log  main;<br />
    error_log  /var/log/nginx_error.log debug;</p>
<p>    server_names_hash_bucket_size 64;<br />
    sendfile on;<br />
    tcp_nopush     on;<br />
    tcp_nodelay    off;<br />
    keepalive_timeout  30;<br />
    gzip  on;<br />
    gzip_comp_level 9;<br />
    gzip_proxied any;</p>
<p>    proxy_buffering on;<br />
    proxy_cache_path /usr/local/nginx/proxy_temp levels=1:2 keys_zone=one:15m inactive=7d max_size=1000m;<br />
    proxy_buffer_size 16k;<br />
    proxy_buffers 100 8k;<br />
    proxy_connect_timeout      60;<br />
    proxy_send_timeout         60;<br />
    proxy_read_timeout         60;</p>
<p>    server {<br />
      listen xxx.xxx.xxx.xxx:81 default rcvbuf=8192 sndbuf=16384 backlog=32000; # Real IP here<br />
      server_name domain.name  _ ;     # &#8220;_&#8221; is for handle all hosts that are not described by server_name<br />
      charset off;<br />
      access_log  /var/log/nginx_host_general.access.log  main;<br />
      location / {<br />
        proxy_set_header Host $host;<br />
        proxy_set_header X-Real-IP $remote_addr;<br />
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />
        proxy_pass http://xxx.xxx.xxx.xxx;    # Real IP here<br />
        client_max_body_size       16m;<br />
        client_body_buffer_size    128k;<br />
        proxy_buffering     on;<br />
        proxy_connect_timeout      90;<br />
        proxy_send_timeout         90;<br />
        proxy_read_timeout         120;<br />
        proxy_buffer_size          16k;<br />
        proxy_buffers              32 32k;<br />
        proxy_busy_buffers_size    64k;<br />
        proxy_temp_file_write_size 64k;<br />
      }<br />
    }<br />
    # below is include so that you can have separate setting per vhost.<br />
    include /usr/local/nginx/vhosts/*.conf;<br />
}</p></blockquote>
<p>In the above config, it&#8217;s general reverse proxy for all domain name on DirectAdmin server. If you need to have a separate configuration like domain A to really use Nginx as a web server, not reverse proxy, then, you can just create that configuration file inside &#8220;/usr/local/nginx/vhosts/&#8221;. Or you may need to change something different from global setting. Just create a new configuration file for that specific Virtualhost.</p>
<p>Also, insert code below if you want to monitor Nginx from Munin or anything similar :</p>
<blockquote><p>server {<br />
       listen 127.0.0.1:81;<br />
       server_name localhost;<br />
       location /nginx_status {<br />
               stub_status on;<br />
               access_log   off;<br />
               allow xxx.xxx.xxx.xxx; # Real IP here<br />
               allow 127.0.0.1;<br />
               deny all;<br />
       }<br />
 }</p></blockquote>
<p>Here, I have to set localport to use port 81 since it&#8217;s the port that we use to monitor this Nginx setup.</p>
<p>3. Create init.d script to be able to start stop nginx service.</p>
<p><code>nano -w /etc/init.d/nginx</code></p>
<p>Copy and paste the code below :	</p>
<blockquote><p>#!/bin/sh<br />
#<br />
# nginx &#8211; this script starts and stops the nginx daemin<br />
#<br />
# chkconfig:   &#8211; 85 15<br />
# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \<br />
#               proxy and IMAP/POP3 proxy server<br />
# processname: nginx<br />
# config:      /usr/local/nginx/conf/nginx.conf<br />
# pidfile:     /usr/local/nginx/logs/nginx.pid</p>
<p># Source function library.<br />
. /etc/rc.d/init.d/functions</p>
<p># Source networking configuration.<br />
. /etc/sysconfig/network</p>
<p># Check that networking is up.<br />
[ "$NETWORKING" = "no" ] &#038;&#038; exit 0</p>
<p>nginx=&#8221;/usr/local/nginx/sbin/nginx&#8221;<br />
prog=$(basename $nginx)</p>
<p>NGINX_CONF_FILE=&#8221;/usr/local/nginx/conf/nginx.conf&#8221;</p>
<p>lockfile=/var/lock/subsys/nginx</p>
<p>start() {<br />
    [ -x $nginx ] || exit 5<br />
    [ -f $NGINX_CONF_FILE ] || exit 6<br />
    echo -n $&#8221;Starting $prog: &#8221;<br />
    daemon $nginx -c $NGINX_CONF_FILE<br />
    retval=$?<br />
    echo<br />
    [ $retval -eq 0 ] &#038;&#038; touch $lockfile<br />
    return $retval<br />
}</p>
<p>stop() {<br />
    echo -n $&#8221;Stopping $prog: &#8221;<br />
    killproc $prog -QUIT<br />
    retval=$?<br />
    echo<br />
    [ $retval -eq 0 ] &#038;&#038; rm -f $lockfile<br />
    return $retval<br />
}</p>
<p>restart() {<br />
    configtest || return $?<br />
    stop<br />
    start<br />
}</p>
<p>reload() {<br />
    configtest || return $?<br />
    echo -n $&#8221;Reloading $prog: &#8221;<br />
    killproc $nginx -HUP<br />
    RETVAL=$?<br />
    echo<br />
}</p>
<p>force_reload() {<br />
    restart<br />
}</p>
<p>configtest() {<br />
  $nginx -t -c $NGINX_CONF_FILE<br />
}</p>
<p>rh_status() {<br />
    status $prog<br />
}</p>
<p>rh_status_q() {<br />
    rh_status >/dev/null 2>&#038;1<br />
}</p>
<p>case &#8220;$1&#8243; in<br />
    start)<br />
        rh_status_q &#038;&#038; exit 0<br />
        $1<br />
        ;;<br />
    stop)<br />
        rh_status_q || exit 0<br />
        $1<br />
        ;;<br />
    restart|configtest)<br />
        $1<br />
        ;;<br />
    reload)<br />
        rh_status_q || exit 7<br />
        $1<br />
        ;;<br />
    force-reload)<br />
        force_reload<br />
        ;;<br />
    status)<br />
        rh_status<br />
        ;;<br />
    condrestart|try-restart)<br />
        rh_status_q || exit 0<br />
            ;;<br />
    *)<br />
        echo $&#8221;Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}&#8221;<br />
        exit 2<br />
esac</p></blockquote>
<p>As the init file is a shell script, it needs to have executable permissions.</p>
<p><code>chmod +x /etc/init.d/nginx</code></p>
<p>Now you can start, stop , reload Nginx through command below :</p>
<p><code>service nginx start<br />
service nginx stop<br />
service nginx restart<br />
service nginx reload</code></p>
<p>Now we have the base script prepared, we need to add it to the default run levels:</p>
<p><code>/sbin/chkconfig nginx on</code></p>
<p>4. Once you&#8217;re done, try to run the website with port 81. Type in your regular URL but end with :81 Such as ..</p>
<blockquote><p>http://www.domainname.com:81/test/information</p></blockquote>
<p>5. If your website loaded as usual, then, it&#8217;s time to redirect all the traffic from port 80 to port 81. Just copy and paste the code below :</p>
<p><code>iptables -t nat -A PREROUTING -p tcp -s ! xxx.xxx.xxx.xxx --dport 80 -j REDIRECT --to-ports 81</code></p>
<p>Now, access your website normally, no need to add port 81.</p>
<p>But if your website doesn&#8217;t work as it should be. You may need to run command below to disable port forwarding so that you can check your configuration again.</p>
<p><code>iptables -t nat -D PREROUTING -p tcp -s ! xxx.xxx.xxx.xxx --dport 80 -j REDIRECT --to-ports 81</code></p>
<p>Actually, I also try to serve cache static file using code below :</p>
<blockquote><p>location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf)$ {<br />
    root   /home/admin/public_html;<br />
    expires 30m;<br />
   }
</p></blockquote>
<p>I don&#8217;t know if I really need that code to make Nginx works properly or not. Still, I tried both configurations. Now&#8230;. how about load?? performance??? Is it worth to do it? &#8230; Since I don&#8217;t have any program to test it. I just base on my feeling alone. I feel that with Nginx as a reverse proxy doesn&#8217;t really help much compare to Apache Worker MPM. The server load is quite the same. The only thing I found it&#8217;s better is memory consumption. (~ 18 M for NginX vs ~ 200 M for Apache)</p>
<p>Note :<br />
1. About nginx.pid, I found that when restart service, sometime it work, sometime it doesn&#8217;t. So, check it carefully.<br />
2. I also tested Reverse proxy cache and it seems to work pretty good. However, most of my websites are Drupal and with Reverse proxy cache, it doesn&#8217;t play well together. When I update content with image, I usually end up with Repeating loop. This will only happen once I do the port forwarding. But if I work on the site with port 81, it works correctly.</p>
<p>Tested with below software :<br />
<em>CentOS 5.4 / 5.5 &#8211; 64 bits<br />
DirectAdmin 1.37 &#8211; With Custombuild 1.2<br />
Apache 2.2.17 &#8211; Worker MPM<br />
Nginx 0.8.5<br />
PHP 5.2.17 / 5.3.5<br />
PHP-FPM in PHP 5.3.5<br />
APC 3.1.7</em></p>
<p>Source :<br />
- http://www.directadmin.com/forum/showthread.php?t=27344<br />
- http://articles.slicehost.com/2009/2/2/centos-adding-an-nginx-init-script</p>
<p>Updated : 2011.06.04<br />
When compile Nginx to use as HTTP server and has a reverse proxy in front of the Nginx, you may need &#8220;http_realip_module&#8221;. (Comparable to mod_rpaf in Apache) So, compile with below command.</p>
<p><code>wget http://nginx.org/download/nginx-1.0.4.tar.gz<br />
tar xvfz nginx-1.0.4.tar.gz<br />
cd nginx-1.0.4<br />
./configure --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module<br />
make<br />
make install</code></p>
]]></content:encoded>
			<wfw:commentRss>http://redhatvn.net/use-nginx-as-a-reverse-proxy-for-directadmin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
