Install Nginx, FastCGI, PHP5, MySQL on Debian and Ubuntu.

[Category: Debian] Share: Bookmark and Share


nginxnginx (pronounced “engine X”) is a lightweight, high-performance Web server/reverse proxy and e-mail (IMAP/POP3) proxy, licensed under a BSD-like license. It runs on UNIX, GNU/Linux, BSD variants, Mac OS X, Solaris, and Microsoft Windows.

Originally, nginx was developed to fill the needs of various websites run by Rambler, for which it was serving 500 million requests per day as of September 2008.

According to Netcraft’s May 2010 Web Server Survey, nginx was found to be the third most widely used Web server across all domains (6.55% of surveyed sites) and the fourth most widely used Web server for all “active” sites (8.77% of surveyed sites). According to W3Techs, it is used on 5.3% of the top 1 million websites, and gains around 0.2% per month. According to another survey by BuiltWith.com, nginx tends to be used on heavily-loaded sites: 4.95% of the top 10,000 sites versus 3.14% of the top million (on July 27, 2010), while Apache is used more on less loaded sites: 63.60% of the top million sites versus 55.79% of the top 10,000 sites. IIS/6.0 is more preferred on the middle range sites: 24.49% of the top 100,000 sites versus 20.05% of the top 10,000 and 21.15% of the top million.

Basic HTTP features

Handling of static files, index files, and auto-indexing
Reverse proxy with caching
Load balancing
Fault tolerance
SSL support
FastCGI support with caching
Name- and IP-based virtual servers
FLV streaming
MP4 streaming, using the MP4 streaming module
Web page access authentication
gzip compression
Ability to handle more than 10000 simultaneous connections

In this post I will teach you how to install nginx with fastcgi, PHP5, MySQL on Debian and Ubuntu.

Step 1

Installing nginx

apt-get install nginx

After installation, start nginx using the following command:

/etc/init.d/nginx start

Step 2

Installing MySQL 5

apt-get install mysql-server mysql-client

During installation, you will receive a password for the root user on your server.

New password for the MySQL "root" user: YourROOTPassword
Repeat password for the MySQL "root" user: YourROOTPassword

Step 3

Install PHP5

apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

In order to run PHP with nginx we use fastcgi. You open the file php.ini for this:

nano /etc/php5/cgi/php.ini

The file should look as follows:

[...]
cgi.fix_pathinfo = 1

To start up the fastcgi processes, we must now stop nginx and use spawn-fcgi program from lighttpd:

/etc/init.d/nginx stop
aptitude install lighttpd
update-rc.d -f lighttpd remove
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
vi /etc/rc.local

Add this command before the exit line...

[...]
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
[...]

VHOSTS

vi /etc/nginx/sites-available/default
[...]
server {
        listen   80;
        server_name  _;

access_log /var/log/nginx/localhost.access.log;

location / {
root /var/www/nginx-default;
index index.php index.html index.htm;
}

location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}

location /images {
root /usr/share;
autoindex on;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/nginx-default;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
[...]

To configure nginx, open this file.

nano /etc/nginx/nginx.conf

Document root for Nginx is /var/www/nginx-default/

thx to: en.wikipedia.org and linode.com/forums

See also

Cool-Linux.com

Recent posts

Cool-Linux.com

Randomized posts

Cool-Linux.com

install nginx fastcgi php5 mysql php, install nginx, install fastcgi, install, install php5, install mysql, install php, run nginx debian, nginx php, nginx installieren php5 MySQL PHP FastCGI, installieren nginx installieren, FastCGI, installieren, installieren php5, mysql installieren, PHP zu installieren, führen Sie nginx Debian nginx php, nginx installieren php5 MySQL PHP FastCGI, installieren nginx installieren, FastCGI, installieren, installieren php5, mysql installieren, PHP zu installieren, führen Sie nginx Debian nginx php, установка FastCGI Nginx php5 MySQL PHP, установить Nginx, установить FastCGI, установить, установить php5, установки MySQL, PHP установки, запуска Nginx Debian, Nginx PHP, 安装nginx的FastCGI的php5的MySQL的PHP,nginx的安装,安装FastCGI的,安装,安装PHP5,安装MySQL,PHP的安装,运行nginx的debian的,nginx的PHP的,nginxののfastcgiのに、インストール、fastcgiをインストールphp5をインストールすると、mysqlの、nginxののdebianは、nginxののPHPを実行にPHPをインストールインストールnginxをインストールすると、のphp5 mysqlのPHPをインストールする, Nginx MySQL PHP FastCGI PHP5 स्थापित Nginx स्थापित FastCGI स्थापित, स्थापित, स्थापित PHP5, MySQL स्थापित करने के लिए, PHP स्थापित है, Nginx debian, Nginx PHP चलाने के लिए, installer php5 fastcgi nginx php mysql, installer nginx, installez fastcgi, installer, installer php5, mysql installer, installer PHP, faire fonctionner Debian nginx, php nginx, Debian, linux, LINUX, unix, Unix, UNIX

Categories



Tell a friend!


Your e-mail:


Your friend's e-mail:




Add CoolLinux to your favorites


apache log files, find log files, apache log files, change hostname, change host name, hostname, host name, change name, hostname file, hostname path, host name path, host path, path host, change hostname, change host name, hostname, host name, change name, hostname file, hostname path, host name path, host path, path host, install lighttpd, lighttpd, web server, lighttpd web server, lighttpd installation, lighttpd debian install, lighttpd debian installation, FreeBSD, SUSE Linux distributions, Red Hat Enterprise, Kubuntu, Fedora Core, Fedora, Edubuntu, ubuntu, Debian, CentOS, game, linux game, unix game, sauerbraten, cube, game, linux game, unix game, OpenArena, game, GPL, linux game, unix game, text login, new mail, warning, message, system message, notice, terminal, text terminal, install, remove, uninstall, Apache, apache, delete, CentOS, Red Hat, Fedora, install apache, remove apache, uninstall apache,, remove, uninstall, Apache, apache, apache debian, apache ubuntu, debian, ubuntu, remove apache, uninstall apache, delete, start, stop, restart, start apache, stop apache, restart apache, Apache, apache, list contents, directory, list directory, PHP, php, contents, content, php list, display date, display time, visitor, PHP, php, date, time, php date, php time, display php, display IP, IP, ip, ip address, IP address, visitor, PHP, php, ip php, word processors, text editor, editor, install, nano, , change, changing, timezone, time zone, reboot, , Learn Persian online!Englisch lernen online kostenlos