Build nginx+php system in http://www.aliyun.com/zixun/aggregation/13835.html ">ubuntu environment
1, install Nginx, execute the following command, quickly completed, but the current apg-get mode installation default is 0.5.33 version
sudo apt install nginx
Configuration file default installation location:
[Quote]conf:/etc/nginx/nginx.conf
Bin:/usr/sbin/nginx
Vhost:/etc/nginx/sites-enable/default
Cgi-params:/etc/nginx/fastcgi-params[/quote]
Build 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 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 php-cgi module to perform sudo apt install php5-cgi profile default installation location:
PHP-CGI:/usr/bin/php-cgi
PHP5-CGI:/usr/bin/php5-cgi
CGI config:/usr/bin/cgi/php.ini [/quote]
Modify the php.ini file Cgi.fix_pathinfo data is 1, the default is 0 cgi.fix_pathinfo=1; This allows the php-cgi to normally use the script_filename variable.
3, the installation of spawn-fcgi spawn-fcgi is a lighttpd tool to control php-cgi.
If the system does not have the GCC compilation environment installed, just need to install the Build-essential Toolkit before installing LIGHTTPD, and execute the following command
sudo apt 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 install Libpcre3-dev
./configure–without-zlib–without-bzip2
Make
sudo cp src/spawn-fcgi/usr/local/bin/spawn-fcgi
This allows the CGI controller to be installed.
4. Start the test system. FAST_CGI:
Spawn-fcgi-a 127.0.0.1-p 9000-c 5-u www-data-g www-data-f
Note: IP, the port corresponds to the Cgi-pass in the Nginx server. -C means to open several CGI processes
Start Nginx
Sudo/etc/init.d/nginx start
Well, if there is no error message, then the configuration is successful, now write a phpinfo test!