Tags

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

sudo yum groupinstall 'Development Tools'

APC

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

Memcached

yum install Memcached
vim /etc/sysconfig/memcached

PORT="11211" USER="memcached" MAXCONN="1024" CACHESIZE="64" OPTIONS="-l 127.0.0.1"

chkconfig --add memcached
cd /usr/local/src/
wget http://pecl.php.net/get/memcache
tar -xvf memcache
cd memcache-3.0.8/
/usr/bin/phpize
./configure -enable-memcache
make
make install
echo “extension=memcache.so” > /etc/php.d/memcache.ini
service httpd restart

Varnish

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

First you must install Varnish: 

  • rpm --nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.0.el6.rpm\
  • Yum install Varnish
    Next you need to follow the instructions: https://www.varnish-cache.org/docs/trunk/tutorial/starting_varnish.html 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 http://www.theshell.guru/change-nginx-port-plesk-12-centos-6-6/

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)

            1 netstat -nlp

Image removed.

Image removed.

 

 

 

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

            1 /usr/local/psa/admin/conf/templates

Copy over the following files from:

            1 2 3 4 5 6 7 8 /usr/local/psa/admin/conf/templates/default   - nginx.php - nginxDomainForwarding.php - nginxDomainForwardingIpDefault.php - nginxDomainVhost.php - nginxDomainVhostIpDefault.php - nginxWebmail.php

to:

            1 /usr/local/psa/admin/conf/templates/custom

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

            1 2 3 4 5 'ssl' => false, 'frontendPort' => $VAR->server->nginx->httpPort,   'ssl' => true, 'frontendPort' => $VAR->server->nginx->httpsPort,

Edit the lines to look like this:

            1 2 3 4 5 'ssl' => false, 'frontendPort' => "8800",   'ssl' => true, 'frontendPort' => "8801",

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.

            1 /usr/local/psa/admin/bin/httpdmng --reconfigure-all

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

            1 netstat -nlp

That’s it, you’re done.