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.