Description: Previous attempts to build the lamp environment on the ubuntu12.04 because of the need to upgrade the PHP version, however, the version of PHP installed through the Apt-get library is 5.3.10, which does not meet the development needs. This note installs PHP 5.5.27. Also upgraded Nginx, the installation of Nginx version is 1.8. This installation uses a newly installed ubuntu12.04 system.
1. Install PHP:
Execute command sequentially
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:Ondrej/php5
sudo apt-get update
sudo apt-GetInstall PHP5
You can do this later by
php-v
View PHP's version
This PHP installed automatically after the installation of the APACHE2 server, through the browser access to the server URL can be seen, do not be surprised, because the Apt-get library is originally Debian. This step means that our PHP installation is successful!
2. Install Nginx:
Before installing Nginx, we have to consider a problem, the previous installation of PHP has been automatically installed apache2. Everyone should understand that the Web server default is listening to the computer's 80 port, Apache2 has occupied our 80 ports, so the installation of Ngixn natural and can not be used. The workaround is simple, get rid of the Apache2 default listening port, or simply uninstall Apache2. Apache2 Uninstall See: http://blog.csdn.net/dazhi_100/article/details/43121179
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
After the command execution is completengixn-vCan be viewed to the Nginx version, while the browser access to the server can be seen, instructions Nginx successfully installed!
3. Configure Nginx:
The previous installation of PHP and Nginx has been successful, and what needs to be done is to allow NGIXN to parse PHP files. This is achieved by modifying the configuration file.
Near the 40 line of the configuration file, you can see the nginx default directory/var/www/html and add index.php to the default Access file.
Locate the default load PHP configuration item in the configuration file, and change it to the following: Remove the # number in front of the white
Save the exit after you finish modifying.
Into the
/var/www/html
Directory, create a new PHP file, the file content is
<?php
Phpinfo ();
?>
Access the file in the browser
502 Error! In fact, our nginx did not find the parser for PHP, we have previously mentioned in the modification configuration file, using the PHP4-FPM engine, but this engine we have not installed. So one more command:
sudo apt-get install PHP5-FPM
To refresh the page in the browser, see:
4. Install MySQL:
sudo apt-get install mysql-server mysql-client
Note The password required to enter the root account of MySQL during installation, please keep it safe and easy to manage the database!
5. Install the MySQL management tool phpMyAdmin:
sudo apt-get install phpMyAdmin
During the installation process will choose the default server, but the default list does not have Apache no nginx, we can not choose direct next!
The phpMyAdmin soft link to the HTML directory, easy to remote database management through the network!
sudo ln-s/usr/share/phpmyadmin/var/www/html
Finally in the browser to access the phpMyAdmin, such as, using the root account and its password to log in to indicate that the entire LNMP environment has been successfully built!
LNMP Environment Construction Notes