<?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>Web Server Hacks Blog - Hacks for Dedicated/VPS Servers, SSH, and Plesk &#187; Web Server Hacks</title>
	<atom:link href="http://webserverhacks.com/category/web-server-hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://webserverhacks.com</link>
	<description>Hacks for Dedicated/VPS Servers, SSH, and Plesk</description>
	<lastBuildDate>Tue, 01 Nov 2011 23:56:45 +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>How to Allow MySQL Access to Certain IP/Servers!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-allow-mysql-access-to-certain-ipservers/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-allow-mysql-access-to-certain-ipservers/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 15:49:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[access]]></category>
		<category><![CDATA[allow mysql]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=148</guid>
		<description><![CDATA[For those of you who run separate MySQL servers, you can easily block unwanted visitors and give access to your other web servers simply replacing &#8220;localhost&#8221; with your subnet such as &#8220;192.168.1.%&#8221;, where the % will be a wild card to allow any servers in the 192.168.1.xxx to connect. This can easily be changed via phpMyAdmin.]]></description>
			<content:encoded><![CDATA[<p>For those of you who run separate MySQL servers, you can easily block unwanted visitors and give access to your other web servers simply replacing &#8220;localhost&#8221; with your subnet such as &#8220;192.168.1.%&#8221;, where the % will be a wild card to allow any servers in the 192.168.1.xxx to connect.</p>
<p>This can easily be changed via phpMyAdmin.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-allow-mysql-access-to-certain-ipservers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Generate SSH Keys!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-generate-ssh-keys/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-generate-ssh-keys/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 14:56:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[generate ssh keys]]></category>
		<category><![CDATA[how to]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=143</guid>
		<description><![CDATA[To generate SSH keys, just do: ssh-keygen -t dsa Then do: cat /root/.ssh/id_dsa.pub Then copy over the whole thing into /root/.ssh/authorized_keys on the server you are trying to get connection. &#160; This can be useful for setting up RSync between two servers.]]></description>
			<content:encoded><![CDATA[<p>To generate SSH keys, just do:</p>
<p><strong>ssh-keygen -t dsa</strong></p>
<p>Then do:</p>
<p><strong>cat /root/.ssh/id_dsa.pub</strong></p>
<p>Then copy over the whole thing into <strong>/root/.ssh/<strong><kbd>authorized_keys</kbd></strong></strong> on the server you are trying to get connection.</p>
<p>&nbsp;</p>
<p>This can be useful for setting up RSync between two servers.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-generate-ssh-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Restart Networking on Linux!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-restart-networking-on-linux/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-restart-networking-on-linux/#comments</comments>
		<pubDate>Sat, 02 Jul 2011 14:48:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux Commands]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[restart networking]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=141</guid>
		<description><![CDATA[Here&#8217;s how to restart networking services on your linux webserver.  I find that especially with VPS web servers, there are times where your network gets blocked completely. To reset, get into SSH via console on your VPS web server company&#8217;s control panel. Type: service network stop then service network start For some web servers, you might have to use: /sbin/service network stop and /sbin/service network start Wait like 5 seconds and see if you can ping the outside world: ping google.com If you get connected, you should be good to go. This can save lots of time restarting a faulty network yourself instead of opening a support ticket and waiting forever.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how to restart networking services on your linux webserver.  I find that especially with VPS web servers, there are times where your network gets blocked completely.</p>
<p>To reset, get into SSH via console on your VPS web server company&#8217;s control panel.</p>
<p>Type:</p>
<p><strong>service network stop</strong></p>
<p>then</p>
<p><strong>service network start</strong></p>
<p>For some web servers, you might have to use:</p>
<p><strong>/sbin/service network stop</strong></p>
<p>and</p>
<p><strong>/sbin/service network start</strong></p>
<p>Wait like 5 seconds and see if you can ping the outside world:</p>
<p><strong>ping google.com</strong></p>
<p>If you get connected, you should be good to go.</p>
<p>This can save lots of time restarting a faulty network yourself instead of opening a support ticket and waiting forever.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-restart-networking-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install PHP-FPM for Nginx!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-install-php-fpm-for-nginx/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-install-php-fpm-for-nginx/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 18:28:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Nginx Hacks]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install php-fpm]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=138</guid>
		<description><![CDATA[Recently, I&#8217;ve switched some of my web servers that handle large file downloads from spawn-cgi to PHP-FPM.  The result is that I can handle more large files with more PHP-CGI processes while my site still loads well even if there&#8217;s many concurrent downloads going on. I am still experimenting with PHP-FPM but it seems like a pretty good way to go as far as handling the PHP-CGI processes. To do this, you will need to install EPEL &#38; CentALT repositories: rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm rpm -Uvh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm Then do: yum install php-fpm to install php-fpm. Edit the file /etc/php-fpm.conf and my suggested setting changes: &#60;value name=&#8221;user&#8221;&#62;apache&#60;/value&#62; &#60;value name=&#8221;group&#8221;&#62;apache&#60;/value&#62; The max_children is set to 1 as default, set it to something like 50, this really is the cool part about php-fpm. &#60;value name=&#8221;max_children&#8221;&#62;50&#60;/value&#62; &#160; PHP-FPM doesn&#8217;t allow for root user and group so I set it to apache.  You will also need to set your web directories to apache user and group by doing: chown apache:apache /mywebdirectory Start the PHP-FPM by doing: /sbin/service php-fpm start If you get some kind of session errors, simply erase all the session files where the error shows. For CentOS, you can do: chkconfig php-fpm on so it &#8230; <a href="http://webserverhacks.com/web-server-hacks/how-to-install-php-fpm-for-nginx/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I&#8217;ve switched some of my web servers that handle large file downloads from spawn-cgi to PHP-FPM.  The result is that I can handle more large files with more PHP-CGI processes while my site still loads well even if there&#8217;s many concurrent downloads going on.</p>
<p>I am still experimenting with PHP-FPM but it seems like a pretty good way to go as far as handling the PHP-CGI processes.</p>
<p>To do this, you will need to install EPEL &amp; CentALT repositories:</p>
<p><strong>rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm</strong></p>
<p><strong>rpm -Uvh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm</strong></p>
<p>Then do:</p>
<p><strong>yum install php-fpm </strong></p>
<p>to install php-fpm.</p>
<p>Edit the file <strong>/etc/php-fpm.conf</strong></p>
<p>and my suggested setting changes:</p>
<p><strong>&lt;value name=&#8221;user&#8221;&gt;apache&lt;/value&gt;</strong><br />
<strong>&lt;value name=&#8221;group&#8221;&gt;apache&lt;/value&gt;</strong></p>
<p>The max_children is set to 1 as default, set it to something like 50, this really is the cool part about php-fpm.</p>
<p><strong>&lt;value name=&#8221;max_children&#8221;&gt;50&lt;/value&gt;</strong></p>
<p>&nbsp;</p>
<p>PHP-FPM doesn&#8217;t allow for root user and group so I set it to apache.  You will also need to set your web directories to apache user and group by doing:</p>
<p><strong>chown apache:apache /mywebdirectory</strong></p>
<p>Start the PHP-FPM by doing:</p>
<p><strong>/sbin/service php-fpm start</strong></p>
<p>If you get some kind of session errors, simply erase all the session files where the error shows.</p>
<p>For CentOS, you can do:</p>
<p><strong>chkconfig php-fpm on</strong></p>
<p>so it will start whenever your webserver is rebooted.</p>
<p>If you have been using fastcgi, make sure to do:</p>
<p><strong>chkconfig fastcgi off </strong></p>
<p>so it doesn&#8217;t interfere.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-install-php-fpm-for-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Optimize Large File Downloads on Nginx!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-optimize-large-file-downloads-on-nginx/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-optimize-large-file-downloads-on-nginx/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 19:32:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Nginx Hacks]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[large file downloads]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[optimize]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=134</guid>
		<description><![CDATA[For those of you who have large file downloads on your web server, your web server might have trouble loading the faster parts of your website while users hog your bandwidth. I&#8217;ve been researching many ways to optimize large file downloads but probably the best way is to simply rate limit the bandwidth on how fast each user can download. You can add the following line to your HTTP directive in /etc/nginx/nginx.conf: limit_rate 100k This will limit each user to download at maximum of 100kb/second. You can change this number to see which one fits best for your server. You can also add limit_rate_after clause to only limit after a portion of the file has been downloaded: limit_rate_after 1m; limit_rate 100k This will limit downloads only after the first megabyte, potentially not slowing down smaller file downloads and your website.]]></description>
			<content:encoded><![CDATA[<p>For those of you who have large file downloads on your web server, your web server might have trouble loading the faster parts of your website while users hog your bandwidth.</p>
<p>I&#8217;ve been researching many ways to optimize large file downloads but probably the best way is to simply rate limit the bandwidth on how fast each user can download.</p>
<p>You can add the following line to your HTTP directive in /etc/nginx/nginx.conf:</p>
<p><strong>limit_rate 100k</strong></p>
<p>This will limit each user to download at maximum of 100kb/second.</p>
<p>You can change this number to see which one fits best for your server.</p>
<p>You can also add limit_rate_after clause to only limit after a portion of the file has been downloaded:</p>
<p><strong>limit_rate_after 1m;</strong><br />
<strong> limit_rate 100k</strong></p>
<p>This will limit downloads only after the first megabyte, potentially not slowing down smaller file downloads and your website.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-optimize-large-file-downloads-on-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Really Great Article on MySQL and Web Server!</title>
		<link>http://webserverhacks.com/performance-tests/really-great-article-on-mysql-and-web-server/</link>
		<comments>http://webserverhacks.com/performance-tests/really-great-article-on-mysql-and-web-server/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 06:35:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Performance Tests]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[MySql]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=111</guid>
		<description><![CDATA[Check out this great article by a MySQL expert who goes into detail how MySQL and web servers work and take on the load on servers. &#8211; link]]></description>
			<content:encoded><![CDATA[<p>Check out this great article by a MySQL expert who goes into detail how MySQL and web servers work and take on the load on servers. &#8211; <a href="http://www.mysqlperformanceblog.com/2006/10/16/should-mysql-and-web-server-share-the-same-box/">link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/performance-tests/really-great-article-on-mysql-and-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Firewall for CentOS Linux!</title>
		<link>http://webserverhacks.com/web-server-hacks/simple-firewall-for-centos-linux/</link>
		<comments>http://webserverhacks.com/web-server-hacks/simple-firewall-for-centos-linux/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 01:02:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[simple]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=103</guid>
		<description><![CDATA[For those of you who are getting DoS attacks and whatnot on your CentOS server, you might want to first make sure you have only WWW (port 80) and SSH (port 22) open. You can do this with iptables (which is pain is the a**) or just use this: yum install system-config-securitylevel Then do: /usr/bin/system-config-securitylevel-tui And there&#8217;s a &#8220;Customize&#8221; menu where you can set WWW and SSH open.]]></description>
			<content:encoded><![CDATA[<p>For those of you who are getting DoS attacks and whatnot on your CentOS server, you might want to first make sure you have only WWW (port 80) and SSH (port 22) open.</p>
<p>You can do this with iptables (which is pain is the a**) or just use this:<br /> <br />
<code><br /> <br />
yum install system-config-securitylevel<br /> <br />
</code><br /> <br />
Then do:<br /> <br />
<code><br /> <br />
/usr/bin/system-config-securitylevel-tui<br /> <br />
</code> </p>
<p>And there&#8217;s a &#8220;Customize&#8221; menu where you can set WWW and SSH open.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/simple-firewall-for-centos-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Fix One PHP-CGI Running!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-fix-one-php-cgi-running/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-fix-one-php-cgi-running/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 01:01:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[one php-cgi process]]></category>
		<category><![CDATA[spawn-cgi]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=101</guid>
		<description><![CDATA[The other day I had a problem with one of my newest servers, upon which I had installed new version of Nginx and Spawn-fcgi. Well, my Nginx kept crashing, actually my PHP-cgi processes started crashing after the server ran for a bit. The weird thing was, the server had no load. Upon carefully watching my &#8220;top&#8221; status in linux for awhile, I realized there&#8217;s only one PHP-CGI process running, whereas all my other Nginx web servers ran multiple (around 5-6 at any given time). I compared out the versions of the Spawn-cgi and realized the new Spawn-cgi I had installed only spawned one PHP-CGI process. I decided to install an older version off Lighttpd and it fixed the problem: wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.bz2 tar -xvjf lighttpd-1.4.18.tar.bz2 cd lighttpd-1.4.18 ./configure make cp src/spawn-fcgi /usr/bin/spawn-fcgi After that restart your PHP-CGI: /sbin/service fastcgi stop /sbin/service fastcgi start Yey, problem solved and now Nginx server runs multiple PHP-CGI processes and no more weird crashes. Sometimes, older programs work better. Perhaps the new Spawn-cgi version has bugs?]]></description>
			<content:encoded><![CDATA[<p>The other day I had a problem with one of my newest servers, upon which I had installed new version of Nginx and Spawn-fcgi.</p>
<p>Well, my Nginx kept crashing, actually my PHP-cgi processes started crashing after the server ran for a bit.  The weird thing was, the server had no load.</p>
<p>Upon carefully watching my &#8220;top&#8221; status in linux for awhile, I realized there&#8217;s only one PHP-CGI process running, whereas all my other Nginx web servers ran multiple (around 5-6 at any given time).</p>
<p>I compared out the versions of the Spawn-cgi and realized the new Spawn-cgi I had installed only spawned one PHP-CGI process.</p>
<p>I decided to install an older version off Lighttpd and it fixed the problem:</p>
<p><strong>wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.bz2<br /> <br />
tar -xvjf lighttpd-1.4.18.tar.bz2<br /> <br />
cd lighttpd-1.4.18<br /> <br />
./configure<br /> <br />
make<br /> <br />
cp src/spawn-fcgi /usr/bin/spawn-fcgi</strong> </p>
<p>After that restart your PHP-CGI:</p>
<p><strong>/sbin/service fastcgi stop<br /> <br />
/sbin/service fastcgi start</strong> </p>
<p>Yey, problem solved and now Nginx server runs multiple PHP-CGI processes and no more weird crashes.  Sometimes, older programs work better.   Perhaps the new Spawn-cgi version has bugs?</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-fix-one-php-cgi-running/feed/</wfw:commentRss>
		<slash:comments>69</slash:comments>
		</item>
		<item>
		<title>How to Reset WordPress Password via MySQL Command Line!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-reset-wordpress-password-via-mysql-command-line/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-reset-wordpress-password-via-mysql-command-line/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 01:01:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[mysql command line]]></category>
		<category><![CDATA[reset wordpress password]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=99</guid>
		<description><![CDATA[For those of you wondering how to reset your WordPress admin password via MySQL command line, here&#8217;s how to do it: Enter your MySQL command line with something like: mysql -uroot -p Then enter your password. Once inside the MySQL command line do: show databases; and then find your database for the WordPress blog that you want to change password. use mydatabase; where mydatabase should be &#8220;your&#8221; database. Then do: update wp_users set user_pass =MD5(&#8217;typenewpasswordhere&#8217;) where id=1; to change the admin password. That&#8217;s it! You can also do: SELECT ID, user_login, user_pass FROM wp_users; to list current users.]]></description>
			<content:encoded><![CDATA[<p>For those of you wondering how to reset your WordPress admin password via MySQL command line, here&#8217;s how to do it:</p>
<p>Enter your MySQL command line with something like:</p>
<p><strong>mysql -uroot -p</strong> </p>
<p>Then enter your password.</p>
<p>Once inside the MySQL command line do:</p>
<p><strong>show databases;</strong> </p>
<p>and then find your database for the WordPress blog that you want to change password.</p>
<p><strong>use mydatabase; </strong> </p>
<p>where mydatabase should be &#8220;your&#8221; database.</p>
<p>Then do:</p>
<p><strong>update wp_users  set user_pass =MD5(&#8217;typenewpasswordhere&#8217;) where id=1;</strong> </p>
<p>to change the admin password.</p>
<p>That&#8217;s it!</p>
<p>You can also do:</p>
<p><strong>SELECT ID, user_login, user_pass FROM wp_users;</strong> </p>
<p>to list current users.</p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-reset-wordpress-password-via-mysql-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add DNS Caching to Your Web Server!</title>
		<link>http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/</link>
		<comments>http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 00:57:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Server Hacks]]></category>
		<category><![CDATA[add dns caching]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[slow api]]></category>
		<category><![CDATA[slow twitter api]]></category>
		<category><![CDATA[slow web server]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://webserverhacks.com/?p=89</guid>
		<description><![CDATA[If you have a website that uses a lot of API requests (such as dealing with Twitter), you can save a lot of server load/costs simply by installing DNS caching to your web server. Each DNS request (every time you request from any domain name using an API) takes anywhere between 0 to 500 miliseconds. Sometimes, adding DNS caching to your web server can make your website load in 1 second versus 10 seconds. Anyways, it&#8217;s easy to do and here&#8217;s how to do it on CentOS/Fedora linux servers: (Ubuntu should be similar, just use apt-get install of yum) First install Bind-utils: yum install bind-utils Do a command: dig yahoo.com Do it several times and note how many miliseconds it takes to retrieve the URL. Later, after we install DNSMasq, we will try dig command again to see if your web server has started caching DNS requests. Install DNSMasq: yum install dnsmasq Edit the file in /etc/dnsmasq.conf: Then add the following lines: listen-address=127.0.0.1 cache-size=500 Next, edit the file in /etc/dhcp6c.conf: Then add the following line: prepend domain-name-servers 127.0.0.1; Next, edit the file in /etc/resolv.conf: Add the following lines with 127.0.0.1 first: nameserver 127.0.0.1 nameserver 208.67.220.220 nameserver 8.8.8.8 nameserver 8.8.4.4 208.67.220.220 &#8230; <a href="http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you have a website that uses a lot of API requests (such as dealing with Twitter), you can save a lot of server load/costs simply by installing DNS caching to your web server.</p>
<p>Each DNS request (every time you request from any domain name using an API) takes anywhere between 0 to 500 miliseconds.   Sometimes, adding DNS caching to your web server can make your website load in 1 second versus 10 seconds.</p>
<p>Anyways, it&#8217;s easy to do and here&#8217;s how to do it on CentOS/Fedora linux servers:  (Ubuntu should be similar, just use apt-get install of yum)</p>
<p>First install Bind-utils:</p>
<p><strong>yum install bind-utils</strong> </p>
<p>Do a command:</p>
<p><strong>dig yahoo.com</strong> </p>
<p>Do it several times and note how many miliseconds it takes to retrieve the URL.  Later, after we install DNSMasq, we will try dig command again to see if your web server has started caching DNS requests.</p>
<p>Install DNSMasq:</p>
<p><strong>yum install dnsmasq</strong> </p>
<p>Edit the file in <strong>/etc/dnsmasq.conf</strong>:</p>
<p>Then add the following lines:</p>
<p><strong>listen-address=127.0.0.1<br /> <br />
cache-size=500</strong> </p>
<p>Next, edit the file in <strong>/etc/dhcp6c.conf</strong>:</p>
<p>Then add the following line:<br /> <br />
<strong> prepend domain-name-servers 127.0.0.1;</strong> </p>
<p>Next, edit the file in <strong>/etc/resolv.conf</strong>:</p>
<p>Add the following lines with 127.0.0.1 first:</p>
<p><strong>nameserver 127.0.0.1<br /> <br />
nameserver 208.67.220.220<br /> <br />
nameserver 8.8.8.8<br /> <br />
nameserver 8.8.4.4</strong> </p>
<p>208.67.220.220 is DNS server of Open DNS, which I highly recommend as it&#8217;s FAST.<br /> <br />
Also 8.8.8.8 and 8.8.4.4 are DNS servers of Google, which are also FAST.<br /> <br />
You can however, decide to use any other DNS such as your hosting company&#8217;s.</p>
<p>You can do a test of how fast they are by doing a ping test such as:</p>
<p><strong>ping 8.8.8.8 </strong> </p>
<p>to test Google&#8217;s DNS server response times.</p>
<p>Next, you can start the DNSMasq so your web server starts caching, do:</p>
<p><strong>/sbin/service dnsmasq start</strong> </p>
<p>Also, you will want to add DNSMasq to your chkconfig list so it will start up next time your web server reboots, do:</p>
<p><strong>chkconfig dnsmasq on</strong> </p>
<p>To check all the processes running at boot-up, do:</p>
<p><strong>chkconfig &#8211;list</strong> </p>
<p>That&#8217;s it!</p>
<p>Now do a dig command on yahoo.com, you should see 0 miliseconds after the first dig command!</p>
<p><strong>dig yahoo.com</strong> </p>
]]></content:encoded>
			<wfw:commentRss>http://webserverhacks.com/web-server-hacks/how-to-add-dns-caching-to-your-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

