Here is just from scratch to build a most basic environment, can let Nginx server run PHP program can, Advanced Configuration I will fill up later. Nginx Automatic Installation:sudo apt-get install nginxStart:Sudo/etc/init.d/nginx StartStop it:Service Nginx StopAccess: Browser access to localhost, successful description of Nginx installation no problem: Install PHP and MySQL:sudo apt-get install php5-cli php5-cgi mysql-server php5-mysqlInstall spawn-fcgi:sudo apt-get install spawn-fcgiStart spawn-fcgi:spawn-fcgi-a 127.0.0.1-p 9000-c 10-u www-data-f/usr/bin/php-cgiTo modify the Nginx configuration file:/etc/nginx/nginx.confTo find the appropriate configuration file, such as/etc/nginx/sites-enabled/defaultFind Index index.html index.htmindex.phpindex.nginx-debian.html;
Location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # with php5-cgi alone:
Fastcgi_pass 127.0.0.1:9000;
# with PHP5-FPM:
# Fastcgi_pass Unix:/var/run/php5-fpm.sock;
}
Add PHP-related content, modifiedre-start Nginx;Sudo/etc/init.d/nginx RestartIn the Nginx configuration file root corresponding to the path, add index.php, through localhost/index.php access, can be accessed normally
<? PHP Phpinfo ();
index.php
Effect:
ubuntu15.10 Simple Construction Nginx+php+mysql