How To Install Nginx PHP MySql On Debian Squeeze

Nginx is an awesome peace of software that is being used worldwide by some of the busiest websites to serve web pages. It's a high performance web server with minimal server consumption and you can run your wordpress blog or a magento store with minimum set of Hardware requirements.

In this post we well install nginx, mysql server and php-fpm on Debian Squeeze on Amazon's Micro EC2 instance.

Unlike Apache php module is not compiled with nginx so we will be installing php-fpm. PHP-FPM ( Fast-CGI Process Manager ) is an implementation of php.

1) Install dependencies and mysql.

# apt-get install gcc libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev openssl libxml2-dev libevent-dev mysql-client mysql-server

2) Add nginx repository in Debian Package Manager. Append the below lines to /etc/apt/sources.list

deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx

3) Verify the debian repo with OpenPGP | Run the below commands

# gpg --keyserver keyserver.ubuntu.com --recv-key ABF5BD827BD9BF62
# gpg -a --export ABF5BD827BD9BF62 | apt-key add -

4) Update repository information and Install nginx

# apt-get update
# apt-get install nginx

5) Add dotdeb repo in /etc/apt/sources.list for PHP-FPM installation and import gpg key, then run apt-get update.

deb http://packages.dotdeb.org stable all

# wget http://www.dotdeb.org/dotdeb.gpg
# cat dotdeb.gpg | apt-key add -
# rm dotdeb.gpg

6) Install PHP5 and other modules

# apt-get update
# apt-get install php5 php5-fpm php-pear php5-common php5-mcrypt php5-mysql php5-curl php5-cli php5-gd php5-dev

7) Start nginx, mysql, and php-fpm.

# service nginx start
# service php5-fpm start
# service mysql start

8) Allow the services to start at server boot.

# update-rc.d nginx defaults
# update-rc.d mysql defaults
# update-rc.d php5-fpm defaults

That's it !! You now have a super fast web server installed.

Deep 9:30 am

About Deep

Network and System Administrator with experience in design, installation, configuration and management of enterprise network and server infrastructure.

Expertise in Linux Server Configuration, Amazon Web Services and Web Server optimisation running Wordpress or Magento.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.