GeoIP block country

The free edition of the GeoIP database is not as accurate as the subscription based database.

Test this by working inside a non important testing directory with a simple testing file such as:

www.site.com/mytesting/index.html

Create a new .htaccess file with the following contents:

SetEnvIf GEOIP_COUNTRY_CODE GB BlockCountry
Deny from env=BlockCountry

This will block GB from your testing directory. Note, this document is only intended to illustrate the possibilities of the use of GeoIP for a basic how to.

Or If you want to redirect based on the country using mod_rewrite in combination with mod_geoip, your .htaccess file could look like this:

RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(NL|BE)$
RewriteRule ^(.*)$ http://www.mydomain.com/nl/$1 [L]

You do not need to enter the path in your .thaccess file:
GeoIPDBFile /path/etc/
Doing so will result in a 500 server error!

Please see the following 3rd party site, the makers of GeoIP for further details:
http://dev.maxmind.com/geoip/legacy/mod_geoip2/

ffmpeg degrades site performance

If your encoder, web service, and media service are all on one server, it is vital that you don’t let one service overrun your maximum CPU for the entire server. Case in point, FFMPEG.

While this is more evident on VPS servers with much fewer processors than dedicated servers, it can still effect entry to mid level dedicated servers.

Review your php script that controls your FFMPEG encoding rate. In this example, we will review the popular Mechbunny tube script:

admin/config.php
$ffmpeg_command

Find the variable listed above and locate the setting:
-threads

This is what sets the maximum amount of processors that FFMPEG can use for encoding videos. The value 0 (zero) indicates unlimited. While new sites that aren’t under any traffic loads can use more threads for FFMEPG, we recommend setting this value at 1/2 your total number of processors. This ensures your web and media service has plenty of CPU to perform vital functions of your site.

Final note, performing download speed tests from your server when you are uploading massive files to your server can most definitely produced slower download times. This often saturates your local network’s uplink speed and therefore inhibits the performance of downloading files.

Disable WordPress Cron

How often should wp-cron.php run?

How often do you update or tend to your website?

As a rule if you only check your website once a day, then run wp-cron.php once a day. If you find that you are getting a LOT of spam comments and Akismet is not keeping on top of it, then you may want to set it to every 6 hours or so.

Even if you were constantly working on a very busy site you would probably only want things to be processed every 30 minutes at the most.

WordPress tries to schedule its own activities using a wp-cron.php script. Unfortunately this script gets called to run every time a visitor comes to your site and can cause high usage.

You should setup a cron job that will only call wp-cron.php less often, something like every 4-6 hours works well.

0 */5 * * * cd /home/username/public_html; php -q wp-cron.php
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

 

Then you’ll want to open up your wp-config.php file and add the following entry to it to disable the default wp-cron from running:

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

define('DISABLE_WP_CRON', 'true');

If you need help adding a crontab we can add one for you.

Crontab Reference

Crontab syntax :

A crontab file has five fields for specifying day , date and time followed by the command to be run at that interval.

*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

* in the value field above means all legal values as in braces for that column.
The value column can have a * or a list of elements separated by commas. An element is either a number in the ranges shown above or two numbers in the range separated by a hyphen (meaning an inclusive range).
Notes
Repeat pattern like /2 for every 2 minutes or /10 for every 10 minutes is not supported by all operating systems. If you try to use it and crontab complains it is probably not supported.

The specification of days can be made in two fields: month day and weekday. If both are specified in an entry, they are cumulative meaning both of the entries will get executed .

Mini Howto Crontab

Disable Email
By default cron jobs sends a email to the user account executing the cronjob. If this is not needed put the following command At the end of the cron job line .

>/dev/null 2>&1

Generate log file
To collect the cron execution execution log in a file :

30 18 * * * rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log

exclude directory for rewrite rules

Many php applications have their own internal URL rewriting techniques. To exclude a path from being included in these rewrite rules, you can do so with htaccess.

WARNING: Make a backup of your original .htaccess file as always. Backups are GREAT practice to follow.
If something goes wrong, please remove the lines from your .htaccess or restore your known working backup file. A simple typo can cause your site to generate a 500 server error. Avoid the panic, make your backup!

RewriteCond %{REQUEST_URI} !=/some_directory

Connecting to Database via MySQL Workbench

You will need to open a Support Ticket with M3 Server.
CLICK HERE to open ticket.

M3 Server will need your IP.
CLICK HERE and you will be provided with your IP.
Note: We need the IP that our site reports so it can be whitelisted. IP should be static, not dynamic, or security will be weakened.

Once your IP has been whitelisted use these steps as follows:

1. Open MySQL Workbench

2. Click the Add icon

Screen Shot 2014-07-03 at 11.20.31 AM

3. Enter a connection name

Screen Shot 2014-07-03 at 11.36.56 AM

4. Select Standard (TCP/IP) as the connection method

5. Click the Advanced tab

Screen Shot 2014-07-03 at 11.39.07 AM

6. Check the box Use the old authentication protocol.

Screen Shot 2014-07-03 at 11.41.05 AM

7.  Clich the Parameters tab

Screen Shot 2014-07-03 at 11.41.56 AM

8. Fill in this information accordingly.

Screen Shot 2014-07-03 at 11.46.54 AM
Hostname yourserver.m3xs.net
Port 3306
Username Database Username
Password: Database Password

9.  Click store in keychain and you will be prompted to enter Database Password

Screen Shot 2014-07-03 at 11.46.34 AM

10. Click OK and you should now be able to connect to your Database

NOTE:
Using MySQL client from the command line, may give you the result:

Warning: Using a password on the command line interface can be insecure.
ERROR 2049 (HY000): Connection using old (pre-4.1.1) authentication protocol refused (client option ‘secure_auth’ enabled)

To bypass this, use the command line option:
–skip-secure-auth

The command line option will then resemble the following:
mysql –skip-secure-auth -u’yourdbusername’ -p’yourpassword’ -h v2505.m3xs.net