System--Ubuntu 14.0 (Virtual machine Linux physical machine Windows)
Target Environment--LNMP
Additional content:
1, directory Sharing (convenient code writing)
2, using secure CRT terminal software connection (easy to operate, do not switch back and forth)
Super permissions are required for most of the following operations
1. Switch to Super User first
2, in order to add sudo xxx (below if the instructions will be omitted, the operation of the self-added)
=============== Split Line ================
======= Configuring the LNMP environment ============
1. Install MySQL
To install the MySQL Run command:
Apt-get Install Mysql-server mysql-client
During the installation, you will be asked to set up a Root account password and enter it two consecutive times:
New password for the MySQL "root" User: <– Enter your password
Repeat password for the MySQL "root" User: <– input again
2. Installing Nginx
Before installing Nginx, if you have installed Apache2 first remove the Nginx in the installation:
Service Apache2 Stop
Update-rc.d-f apache2 Remove
Apt-get Remove Apache2
Apt-get Install Nginx
To start the Nginx service:
Service Nginx Start
Ifconfig view Ubuntu IP, Access IP in the browser, if the occurrence of the relevant Nginx page proved successful.
3, Installation PHP5
Pt-get Install PHP5-FPM
PHP-FPM is a daemon process.
4. Configuring Nginx and PHP5
Here you can not use the Nginx default file configuration, the CP is a part of its own configuration. (/etc/nginx/sites-available)
Then in/etc/nginx/sites-enabled, create a soft-connect copy. Ln-s/etc/nginx/sites-available/Profile Name
Edit configuration,/etc/nginx/sites-available in the
1. Custom Port
2, then put the following sentence annotation interface
Location ~ \.php${(here Main, if the former is to be changed to this location ~ \.php($|/) {, this is to use PathInfo after the CI settings,/can be parsed)
Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include Fastcgi_params;
After saving the exit, restart the next Nginx,/etc/init.d/nginx reload.
----If the restart fails, there is an error in the configuration file.
Configuring the PhP5 file
Open config file /etc/php5/fpm/php.ini ...
Vi/etc/php5/fpm/php.ini
Cgi.fix_pathinfo=0: = = " cgi.fix_pathinfo=1:
Vi/etc/php5/fpm/pool.d/www.conf
Listen = 127.0.0.1:9000
Save exit, Reload under PHP5-FPM, service php5-fpm reload.
Under test:
Now create a probe file saved in the /usr/share/nginx/html directory
vi/usr/share/nginx/html/info.php = = "<?php phpinfo ();?>
Browser access (e.g. http://192.168.0.100/info.php), showing PHP related information to prove that PHP is working properly.
5. Test MySQL connectivity status
Now we're going to use PHP to connect to MySQL. Create a mysql.php file with the following content:
<?php
$host = ' 127.0.0.1 ';
$root = ' root ';
$pwd = ' 123456 ';
$con = mysql_connect ($host, $root, $pwd);
if ($con = = False) {
echo "Connect false";
} else{
echo "Connect true";
}
?>
Return true proof of connectivity, this build LNMP also basically completed. Enjoy it.
======= Split Line ===============
1. Shared directory
Virtual machine settings shared directory, shared Windows under a folder,/mnt/hgfs directory for you to share folders.
2. Using secure CRT remote connection terminal
Install OpenSSH under Linux using Apt-get.
Then use secure CRT, fill in IP, user name, authentication this choice password, basically have no problem, can connect.
==============end================
"CI Framework" environment construction