How To Install Nginx PHP MySql On Debian Squeeze

September 18, 2013 | By
| Reply More

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.

Filed Under : LINUX HOWTO

Free Linux Ebook to Download

Leave a Reply

Commenting Policy:
Promotion of your products ? Comment gets deleted.
All comments are subject to moderation.