The installation steps are as follows:
1.Nginx
1.1 Add source and install
1.1.1 sudo add-apt-repository ppa:nginx/stable
1.1.2 sudo apt-get update
1.1.3 sudo apt-get install Nginx
1.2 Test
1.2.1 Starts Nginx:sudo/etc/init.d/nginx start
1.2.2 Access: http://localhost
"Welcome to Nginx!" appears and the installation is successful.
1.2.3 Turn off Nginx:sudo/etc/init.d/nginx stop
2.PHP
2.1 Installation
2.1.1 sudo apt-get install php5-cli php5-cgi php5-fpm php5-mcrypt php5-mysql
PHP5-FPM: One of the ways of cooperating with Nginx, the other is: spawn-fcgi;
Php5-mysql: access to MySQL;
PHP–FPM is the port 9000 of a daemon (with initialization scripts/ETC/INIT.D/PHP5-FPM) running on the fastcgi server.
2.2 Modify Nginx configuration
2.2.1 sudo vim/etc/nginx/sites-available/default
2.2.2 To change the row of index to: " Index index.html index.htm index.php; "
Remove the following comments to support PHP scripts:
Location ~ php$ {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php; index index.html index.htm index.php;
include fastcgi_params;
}
2.3 Test
2.3.1 New directory: sudo mkdir/var/www/
2.3.2 Modify Nginx directory: sudo vim/etc/nginx/sites-available/default
Change the root row to "root/var/www;"
Error_page 502 503 504/50x.html;
Location =/50x.html {
#root/usr/share/nginx/www;
root/var/www;
}
2.3.3 New test file: sudo vim/var/www/test.php
Note the top-level directory of the newly created file to set permissions chmod 777/var/www, otherwise test.php file cannot be saved.
Enter: ""
2.3.4 starts Nginx:sudo/etc/init.d/nginx start
2.3.5 Access: http://localhost/test.php
The PHP details appear and the configuration is successful.
2.3.6 Turn off Nginx:sudo/etc/init.d/nginx stop
2.4 Installing some common PHP extensions
Apt-get Install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming Php5-ps Php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
To restart PHP-FPM command:/etc/init.d/php5-fpm restart
3.MySQL
3.1 Installation
3.1.1 sudo apt-get install Mysql-server
The root password is required during installation.
3.2 Test
3.2.1 Login Mysql:mysql-u Root-p
Enter password
3.2.2 the "mysql>" prompt and successfully logged in.
3.2.3 Exit Mysql:exit
4. Install phpMyAdmin
sudo apt-get install phpMyAdmin Description: Will let in Apache and LIGHTD choose one, no nginx, I chose Apache, and then set the user password can be.
Move to working directory
sudo mv/usr/share/phpmyadmin//usr/share/nginx/www/
OK, restart your linux server, your PHP mysql nginx phpmyadmin all installed.