Ubuntu8.04 quickly build the nginx + php (fastcgi) System

Source: Internet
Author: User
I played nginx + php in FreeBSD yesterday and went to Ubuntu today. First of all, I would like to thank the article "over enough". The following is a change from his article. It is much faster to build on Ubuntu than on freebsd, because on Freebsd, I use ports for installation and need to be compiled. on Ubuntu, I directly install apt-getinstall, which is fast, let's start the installation! 1. Install nginx and execute the following command, which will be completed soon, but currently apg-get

I played nginx + php in FreeBSD yesterday and went to Ubuntu today. First of all, I would like to thank the article "over enough". The following is a change from his article. It is much faster to build on Ubuntu than on freebsd, because on Freebsd, I installed on ports and needed to be compiled. on Ubuntu, I installed on apt-get install directly, which is fast, let's start the installation!

1. Install nginx. Execute the following command and it will be completed soon. However, the default installation version of apg-get is 0.5.33.

Sudo apt-get install nginx

Default Configuration File Installation location:

Conf:/etc/nginx. conf
Bin:/usr/sbin/nginx
Vhost:/etc/nginx/sites-enable/default
Cgi-params:/etc/nginx/fastcgi-params


For example, create a virtual Server

Server {
Listen 80;
Server_name www.23day.com;
Access_log/var/log/nginx/home. ucenter. access. log;

Location /{
Root/var/www/23day.com;
Index. php;

Location ~ \. Php $ {
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME/var/www/23day.com $ fastcgi_script_name;
Include/etc/nginx/fastcgi_params;
}
}


2. Install the php-cgi Module.

Execute sudo apt-get install php5-cgi

Default Configuration File Installation location:

QUOTE:
Php-cgi:/usr/bin/php-cgi
Php5-cgi:/usr/bin/php5-cgi
Cgi config:/usr/bin/cgi/php. ini


Modify the cgi. fix_pathinfo data of the php. ini file to 1. The default value is 0.

Cgi. fix_pathinfo = 1; so that php-cgi can use the SCRIPT_FILENAME variable normally.

3. Installing spawn-fcgi is a lighttpd tool used to control php-cgi.

If the GCC compiling environment is not installed in the system, you just need to install the build-essential toolkit before installing lighttpd and execute the following command

Sudo apt-get install build-essential
Wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz
Tar-xvf lighttpd-1.4.19.tar.gz
Cd lighttpd-1.4.19/
Sudo apt-get install libpcre3-dev
./Configure-without-zlib-without-bzip2
Make
Sudo cp src/spawn-fcgi/usr/local/bin/spawn-fcgi


The cgi controller is installed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.