Installing APC Memcached and Varnish on Media Temple DV Level 4 Centos 6.5

I see many tutorials around the net and many do not work, so to add to the Chaos.

sudo yum groupinstall 'Development Tools'


cd /usr/local/src/
tar -xvf APC-3.1.9.tgz
cd APC-3.1.9
./configure -enable-apc -enable-apc-mmap -with-apxs2=/usr/sbin/apxs -with-php-config=/usr/bin/php-config
make install
echo “” > /etc/php.d/apc.ini
rm -rf /usr/local/src/APC*
service httpd restart


yum install Memcached
vim /etc/sysconfig/memcached


chkconfig --add memcached
cd /usr/local/src/
tar -xvf memcache
cd memcache-3.0.8/
./configure -enable-memcache
make install
echo “” > /etc/php.d/memcache.ini
service httpd restart


Varnish is far more complicated on Media temple and documentation is very poor

First you must install Varnish: 

  • rpm --nosignature -i\
  • Yum install Varnish
    Next you need to follow the instructions: There are a couple of pages: file is at /etc/sysconfig/varnish I have attached mine *NB* replace serverIPADDRESS with your IP address also set new vcl if you need to (most likely mine is custom for drupal and beyond the scope of this article)

Service Varnish Start -- mostly done, however! on media temple nginx listens on port 80 and it's not easy to change out.
I found a lot of help on the nginx link

We started experimenting with Varnish in a bid to tackle load instead of adding full blown replicated web server nodes. Once we were done with testing we ran into trouble implementing the set up on Plesk. There isn’t a whole lot of documentation on this matter so we ended up banging our heads on a lot of walls before we figured it out. Thankfully, though, Plesk is a lot easier and friendlier to hack than WHM/cPanel.

So, below we’ll show you how to move NGINX to a non-standard port, meaning away from port 80.

If you enter the following at shell you’ll see NGINX listening to port 80(http) and 443(https)






Start by heading over to the following path, create a directory called custom.

Copy over the following files from:


Once copied, look for the following lines in all the 6 files:

Edit the lines to look like this:

Repeat this for all 6 files.

Run the following to regenerate config files for all domains

Note: If you have made any changes in files under /etc/php-fpm.d or /etc/nginx, they most probably will be reset. So make sure you back those up to restore them later.

Issue the following again to verify that nothing is listening to either port 80 or 443

That’s it, you’re done.