Top Nav

Plesk 11 – vhost.conf File For Nginx

We’re all familier with using a vhost.conf file on Plesk to provide custom Apache directives to an individual virtual host. Originally the file was located at:

Recent versions of Plesk have moved the file to:

And of course there is an SSL version of the file at:

The good news is there’s also now a file for Nginx at:

By default these files don’t exist and are not included in the configuration. So you’ll need to create the file and then run:

or

 

0

Generate Rewrite Rules From CSV File

Here’s a simple Perl script that can be used to convert a CSV file of redirects into Apache rewrite rules:

The script assumes that you have 2 column – the source URL and the destination URL. You might invoke the script like this:

Sometimes the CSV file will be DOS formatted to I’ll do:

There are may ways that this script could be expanded or improved but it’s a good starting point for the typical case.

0

Clone RackSpace Cloud Files Container With TurboLift

turbolift is an absolutely brilliant utility for manipulating RackSpace Cloud Files.  With turbolift you can do things like:

  • Upload a directory, (recursively)
  • Upload a single file
  • Upload a local directory (recursively) and sync it with a Cloud Files Container
  • Download a Container to a local directory
  • Download changed objects from a Container to a local directory
  • Compresses a Local Directory, then uploads it
  • List all Containers
  • List all Objects in a Container
  • Delete an Object in a Container
  • Delete an entire Container
  • Clone one Container in one region to another Container in the same or Different Region.
  • Set Custom headers on Objects/Containers

Wow!

So in this article I’m going to demonstrate how to clone a container.

Here’s the download link for turbolift:

https://github.com/cloudnull/turbolift

On CentOS 6.5 the install is easy:

Now lets assume that we have a container on RackSpace Cloud Files name “devimages” and we want to copy or clone the contents of that container to another container named “prodimages”. Here’s the turbolift command:

The [SOURCE REGION] and [DESTINATION REGION] should be one of ’dfw’, ‘ord’, ‘iad’, ‘lon’, ‘syd’ or ‘hkg’.

turbolift is fast – it takes about 10 minutes to clone a 2GB container with 18K objects in the same region.

0

Increase Nginx Upload Limit On Server With Plesk Panel

From the Plesk Panel you can set the PHP upload_max_filesize at Website & Domains -> PHP Setting. But if you’re using Nginx then you may also need to configure Nginx to allow larger uploads. We saw errors like this in the /var/log/nginx/error_log:

To resolve the issue edit /etc/nginx/nginx.conf and set client_max_body_size by adding the highlighted line:

 

0

Lightweight 404 For Apple Touch Icons

Had a site recently that was complaining about bandwidth consumed by request for apple-touch-icon* files as described here:

http://mathiasbynens.be/notes/touch-icons

The customized 404 page on the site was using about 55K bytes for each request. I added the following rewrite rule:

This results in about 500 bytes per request or a 100 fold reduction.

Of course a nicer solution would be add pretty touch icons to the site!

 

 

0