Author Archives: admin

How to Backup Multiple MySQL Databases Automatically! [SCRIPT]

Tired of making MYSQL database backups one by one? If you are migrating to another server or want to do a monthly MYSQL database backup of all databases in your server, you can do so by using a script that will backup all of your databases at once.

Of course, you will want to save each database separately in case you just want to restore one at a time plus it will be easier when restoring.

Here’s a script you can use, replace password with your root password.

#!/bin/bash # webserverhacks.com USER="root" PASSWORD="password" OUTPUTDIR="." MYSQLDUMP="/usr/bin/mysqldu

Click Here to Read Full Article

Leave a comment

How to Change Time Zone for System Date on CentOS!

Here’s how to change time zone for system date on your CentOS web server:

Go into the directory zoneinfo:

cd /usr/share/zoneinfo

Then find the right zone file for you such as for me Los Angeles is for PST (Pacific Standard Time), which is here:

/usr/share/zoneinfo/America/Los_Angeles

Then simply copy over that file to /etc/localtime like this:

cp /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Run the date command:

date

and you should get something like:

Wed Jul 6 16:56:47 PDT 2011

Instead of the othe

Click Here to Read Full Article

Leave a comment

How to Allow MySQL Access to Certain IP/Servers!

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 “localhost” with your subnet such as “192.168.1.%”, 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.

Click Here to Read Full Article

Leave a comment

How to Generate SSH Keys!

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.

 

This can be useful for setting up RSync between two servers.

Click Here to Read Full Article

Leave a comment

How to Restart Networking on Linux!

Here’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’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

Click Here to Read Full Article

Leave a comment

How to Install PHP-FPM for Nginx!

Recently, I’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’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 & CentALT repositories:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm

rpm -Uv

Click Here to Read Full Article

Leave a comment

How to Optimize Large File Downloads on Nginx!

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’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

Click Here to Read Full Article

Leave a comment

Really Great Article on MySQL and Web Server!

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. – link

Click Here to Read Full Article

Leave a comment

How to Check MySQL/PHP Version via Command Line!

To check your MySQL version via linux command line, type:

# mysql -version mysql Ver 14.12 Distrib 5.0.45, for redhat-linux-gnu (i386) using readline 5.0

and for PHP version:

# php -version PHP 5.2.6 (cli) (built: May 8 2008 08:53:44)

Most linux commands allow you to check the version simply by adding -version after the command.

Click Here to Read Full Article

Leave a comment

How to Display WordPress Error Messages!

If for some reason you need to debug your WordPress theme, plugin, or just need to see all the error messages, you can add the following line in your wp-config.php file: define(‘WP_DEBUG’, true);

WordPress by default hides error messages so this will reveal them.

Click Here to Read Full Article

Leave a comment