Update Source:
Apt-get Install update
Close apache2:
/etc/init.d/apache2 stop
Install Nginx:
Apt-get Install Nginx
Install MySQL:
Apt-get install Mysql-server #连续输入两次相同密码, password for use with MySQL managed account
Install PHP:
Apt-get Install PHP5-FPM Php5-mysql
To configure PHP, modify the php.ini file:
Cp/etc/php5/fpm/php.ini/etc/php5/fpm/php.ini.back #备份php. ini file
Vim/etc/php5/fpm/php.ini
cgi.fix_pathinfo=0# Remove PathInfo mode with security implications
Start PHP-FPM
Service PHP5-FPM Restart
Configure Nginx to use the PHP5-FPM process
Cp/etc/nginx/sites-available/default/etc/nginx/sites-available/default.back
Vim/etc/nginx/sites-available/default
server {
Listen default_server;
Listen [::]:80 default_server Ipv6only=on;
root/usr/share/nginx/html;
Index index.html index.htm;
server_name localhost;
Location/{
# First attempt to serve request as file, then
# as Directory, then fall back to displaying a 404.
Try_files $uri $uri/= 404;
# Uncomment to enable Naxsi
# Include/etc/nginx/naxsi.rules
}
Error_page 502 503 504/50x.html;
Location =/50x.html {
root/usr/share/nginx/html;
}
Location ~ \.php$ {
# try_files $uri = 404;
Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
# # Note:you should has "cgi.fix_pathinfo = 0;" In php.ini
#
# # with php5-cgi alone:
# Fastcgi_pass 127.0.0.1:9000;
# with PHP5-FPM:
Fastcgi_pass Unix:/var/run/php5-fpm.sock;
Fastcgi_index index.php;
# Fatcgi_param Scritp_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
}
Restart Nginx Service:
Service Nginx Restart
To establish a info.php test file:
vim/usr/share/nginx/html/info.php
<?php
Phpinfo ();
?>
Browser testing:
http://IP/info.php
Upload the original PHP Web page file to the/usr/share/nginx/html/directory
Ubuntu14.04 Build LNMP Platform