Yesterday just to the company server installed LNMP Server environment, here simply record the process memo.
Here I am in the installation of the time is used Dotdeb source, for reference only.
1. Import Dotdeb Source, it is said that the Dotdeb source software version is relatively new.
Before importing dotdeb into the source, we need to get GnuPG key and import it:
wget http://www.dotdeb.org/dotdeb.gpgcat DOTDEB.GPG | Apt-key Add-
Prompt OK to indicate that the import was successful. Then we start importing the Dotdeb source, where the source list is in "/etc/apt/sources.list", we open the sources.list with the VI tool or the Nano tool and add the following two lines:
Deb http://packages.dotdeb.org wheezyall deb-src http://packages.dotdeb.org wheezy All
Update source after completion:
apt-Get update
You can then start installing Nginx, MySQL, and PHP.
2.MySQL
To install using the APT tool:
apt-get install-y mysql-server mysql-client
During installation, you will be asked for the root password, and you can enter the password you want to set.
After the installation is complete, perform the following configuration commands:
Mysql_secure_installation
Follow the prompts to go down on the line, the process will ask whether to change the root password, whether to remove anonymous users, whether to prohibit root remote login, etc., their own on-demand configuration.
Note: I found that the remote client was unable to connect to the database while using MySQL and later found that the problem was "bind-address = 127.0.0.1" in the "/etc/mysql/my.cnf" file. The address is bound to the 127.0.0.1, so the remote can not access to the database, here we can comment off it, or your server is the designated IP address is configured to your server IP addresses.
Of course it is possible that your MySQL does not have permission to open the remote access account, if this is the reason, just add a record in the MySQL user table:
Grant all privileges on * * to [email protected]'%'123456' With GRANT OPTION; FLUSH privileges;
Then restart the MySQL service:
Service MySQL Restart
3. Install PHP
To install using the APT tool:
apt-get install php5-fpm php5-gd php5-mysql php5-memcache php5-curl
If the Php5-memcache extension is installed on the command above, continue to install memcached:
apt-get install memcached
After the installation is complete, you can use "php5-fpm-v" to view the PHP version.
4. Installing Nginx
I installed the full expansion of Nginx (Nginx-full), the rear may have functional enhancements, so when the installation is installed directly all:
apt-get install-y nginx-full
Then start the Nginx:
Service Nginx Start
Ask the address HTTP://IP, if you see the following, it means that your nginx installation is normal.
Next, configure the Nginx,nginx configuration file in the "/etc/nginx/sites-available/default"
... location ~ \.php$ {fastcgi_split_path_info ^ (. +\.php) (/.+ cgi.fix_ pathinfo = 0; " in php.ini # # # with php5 -cgi alone: # fas Tcgi_pass 127.0 . 0.1 : 9000 -fpm:fastcgi_pass Unix: /var /run/php5-fpm.sock; Fastcgi_index index.php; Include Fastcgi_params; } ...
After saving, restart Nginx:
Service Nginx Restart
Then we create a PHP page to test:
nano/usr/share/nginx/html/phpinfo.php
Input:
<?php phpinfo ();?>
After saving direct access: http://ip/phpinfo.php, if the Phpinfo page appears, then our work is finished!
Related reading:
Configuring the Site Directory permissions setting in the Nginx environment
Http://www.111cn.net/sys/nginx/61498.htm