≡ Menu

Debian Web Server: Nginx with APC and Varnish to Optimize WordPress

This tutorial is how to make a Web Server under Debian 6 using Nginx web server, MySQL as a database server, PHP-FPM as a fastCGI server, APC as an optcode cache and Varnish as a caching proxy to optimize a website using wordpress.

I have tried this method using Debian 6.0.5 32BIT on XEN VPS with 512 Memory.

Step 1: Adding main debian repos

Because i’m using idROOT as Indonesia VPS Provider, so i’m using Indonesian repository which is located at Kambing.ui.ac.id

Step 2: Adding dot-deb repo

Step 3: Update and adding base software

Step 4: Adding Varnish repo and Install Varnish

Step 5: Adding a system user and Add user to sudo

find: root ALL and then add this line below : [USER] ALL=(ALL) ALL

Step 5: Installing Software

Step 6: Configuring MySql

Insert this code into /etc/mysql/my.cnf

Step 6: Configuring nginx

Insert this code into /etc/nginx/nginx.conf

Insert this code into /etc/nginx/sites-available/default

Step 7: Fix CGI Path Info

find cgi.fix_pathinfo and Uncomment the command by removing the ; in front and replace the defauly 1 with a 0!

Step 8: Configuring PHP5-FPM

Insert this code into /etc/php5/fpm/php-fpm.conf

Insert this code into /etc/php5/fpm/pool.d/www.conf

Step 9: Configuring Varnish

Insert this code into /etc/default/varnish

Insert this code into /etc/varnish/default.vcl

step 10: Securing VPS

Securing SSH

–find: PermitRootLogin yes
–change to: PermitRootLogin no

–find: X11Forwarding yes
–change to: X11Forwarding no

–find: Port 22
–change to: 7766

–add to end: UseDNS no

Restart SSH

Installing IPTABLES

// Show what is loaded in our firewall

// Flush everything we have in our firewall

// Allow established sessions

// Allow services

// End iptables by blocking everything that we didn’t explicitly allowed earlier

// backup iptables to a file

Making sure iptables rules are reloaded on reboot

Insert this code

Restartig our services

Reference:
http://www.axelsegebrecht.com/how-to/install-nginx-apc-varnish-wordpress-and-w3-cache-128mb-vps/
http://library.linode.com/lemp-guides/debian-6-squeeze
http://www.farinspace.com/wordpress-nginx-rewrite-rules/

{ 0 comments… add one }

Leave a Comment