WebFaction
Community site: login faq

Hello

I would like to know if its possible to use Varnish in favor of apache to run my drupal site or to just use Varnish for Caching Drupal Site ?

I am trying to follow the following guide, but its for ubuntu and not centos

How to speed up Durpal with Varnish

asked 09 Dec '14, 03:15

Ibn Saeed
114
accept rate: 0%

edited 09 Dec '14, 03:16

Hello,

You should be able to setup Varnish, though you will likely need to setup your own Apache+PHP stack as well. I think you may find more helpful information here:

Easy reverse proxy cache with Webfaction?

(09 Dec '14, 03:43) NickR ♦♦

I am looking for a step by step tutorial for setting it up in webfaction

(09 Dec '14, 04:09) Ibn Saeed

  1. Install a private instance of the shared Apache.
  2. Create a 'custom app listening on port' application in the control panel to reserve a port number for Varnish, then create a site to serve that app.
  3. As your secondary SSH user from step 1, install varnish as follows:
    mkdir -p ~/{src,tmp}
    cd ~/src
    wget https://repo.varnish-cache.org/source/varnish-4.0.2.tar.gz
    tar zxf varnish-4.0.2.tar.gz 
    cd varnish-4.0.2
    ./configure --prefix=$HOME/varnish
    make
    make install
    cp share/doc/varnish/example.vcl ./drupal.vcl
  4. Edit ~/varnish/drupal.vcl to look like this, changing NNNNN to the port number of the private Apache app you created in step 1.
  5. Create a MySQL database and user in the control panel.
  6. As your secondary SSH user from step 1, install Drupal. I'll use the 'app1' directory from step 1 for this example:
    cd ~/webapps/app1
    wget http://ftp.drupal.org/files/projects/drupal-7.34.tar.gz
    tar zxf ~/src/drupal-7.34.tar.gz --strip 1
    rm drupal-7.34.tar.gz
  7. As your secondary SSH user from step 1, edit ~/private_apache/conf/httpd.conf to change the first VirtualHost's ServerName and ServerAlias to match the domain and www subdomain of the site you created in step 2.
  8. As your secondary SSH user from step 1, start your private Apache: ~/private_apache/bin/start
  9. As your secondary SSH user from step 1, start Varnish with the following command, replacing NNNN with the port number from the app you created in step 2.:
    ~/varnish/sbin/varnishd -a 127.0.0.1:NNNNN -f ~/varnish/drupal.vcl
  10. Visit the site you created in step 2 to complete the installation of Drupal, using the info for the database you created in step 5.
  11. Log into your Drupal site, go to Configuration > Performance and turn on caching for anonymous pages and blocks, and set the cache expiration times to 30 minutes or higher.
That's it - you're done! Your new Drupal site is now ready to serve thousands of requests per second :)

permanent link

answered 09 Dec '14, 20:29

seanf
12.2k41836
accept rate: 37%

edited 09 Dec '14, 20:53

Thanks sean, for going through all the steps.

I still have to try it out in my account.

(10 Dec '14, 04:56) Ibn Saeed
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×63
×7

question asked: 09 Dec '14, 03:15

question was seen: 2,274 times

last updated: 10 Dec '14, 04:56

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM