Recently changed the development environment to Ubuntu, organized the installation configuration of the development environment and common software
One. Lamp Environment Construction
Based on the latest Ubuntu14.04 (2014 September), built Nginx, php,mysql environment,
All of the following command-line operations:
1, because of the need for a large number of permissions to operate, the convenience of temporary elevation of privilege, using Root Account
sudo su
2, install the apt Source management tool, add nginx and PHP installation source
Apt-get Install Python-software-properties
Add-apt-repository ppa:nginx/stable
Add-apt-repository PPA:ONDREJ/PHP5
3, update the system software
Apt-get Update
4. Installation MySQL
Apt-get Install Mysql-server
Note: During the installation process, you will be asked to enter the password for the root account of MySQL.
5. Installation of PHP and support for MySQL
Apt-get Install PHP5 php5-fpm PHP5-MYSQLPHP-APC
6, according to the actual needs, the optional installation of various types of PHP functional modules (specifically please Baidu)
Apt-get Install php-pear Php5-dev php5-curl
Apt-get Install PHP5-GD Php5-intlphp5-imagick
Apt-get Install Php5-imap Php5-mcryptphp5-memcache
Apt-get Install php5-ming php5-ps Php5-pspell
Apt-get Install Php5-recode Php5-snmpphp5-sqlite
Apt-get Install Php5-tidy php5-xmlrpcphp5-xsl
7. Installation Nginx
Apt-get Install Nginx
8. Configuration PHP
Vi/etc/php5/fpm/php.ini
Found in:; cgi.fix_pathinfo=1
Instead:cgi.fix_pathinfo=0
9. Configure Nginx
Mkdir/www
chmod 775/www
755 Permissions
10. Solve php-fpm and Nginx's small bug
Following the above steps, due to a small bug between Nginx and php-fpm , this phenomenon can be caused by:
*.html can be accessed normally, while the *.php file returns a 200 status code,
But the actual output to the browser page content is blank.
in short, the reason is Nginx will not correctly
The address of the *.php file is passed to php-fpm to parse,
The equivalent of PHP-FPM received a request, but this request points to a nonexistent file, and returns an empty result.
in order to solve this problem, we need to change nginx default fastcgi_params configuration file:
Vi/etc/nginx/fastcgi_params
Add a line at the end of the file:
Fastcgi_param Script_filename$document_root$fastcgi_script_name;
For the contents of this line, say a few words, of which there are two parameters:
$document _root means the root directory of the website, that is, we have just set the root/www in front ;
$fastcgi _script_name refers to each *.php file name on the website (in fact, the relative path of the files)
/test/script.php file,
The full path that Nginx passes to php-fpm is:/www/test/script.php
I said in front of the configuration Nginx, written root/www/, this writing, for Nginx is not a problem,
But when it passes php file paths to PHP-FPM, it forms:/www//test/script.php
This file address is invalid (not getting the correct php file), so there is a problem with the return blank.
The problem is so hidden that I spend a lot of time looking at LOG, finding information, and adjusting settings.
11, restart the services
Service PHP5-FPM Reload
Service Nginx Reload
Reload the configuration changes.
12. Testing
vi/www/index.php
Content:
<?php echo phpinfo ();?>
Please open your browser to access:http://localhost If everything works, it will output PHP environment information, such as:
Two. Nginx configuration file Modification, configure the virtual host
1. Modify Nginx.conf
Vim/etc/nginx/nginx.conf
include/etc/nginx/sites-enabled/* under the node;
Added: include/etc/nginx/sites-available/*;
Nginx-t test file is correct
Delete a file under sites-enabled
After modifying the configuration file, execute the following command to load the new configuration file
Nginx-s Reload
Stop Nginx service Nginx stop
Start Nginx service Nginx start
2. Virtual Host Configuration
Upstream backend{
Server 192.168.0.110:9000;
Server 192.168.0.113:9000;
}
server {
Listen 80;
root/www/www.test.com;
# ADD index.php to the list if you are using PHP
Index index.php index.html index.htm index.nginx-debian.html;
server_name www.test.com;
Location/{
Try_files $uri $uri/= 404;
}
Location ~ \.php$ {
#root html;
Fastcgi_pass backend;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include Fastcgi_params;
}
}
3. Modify/etc/hosts file after modification to add 127.0.0.1 server_name (virtual host name)
CD/ETC/INIT.D./networking Restart Restart Network Service
Three Modify PHP configuration file
1.vim/etc/php5/fpm/pool.d/www.conf
Note Listen =/var/run/php5-fpm.sock
New Listen = 9000
Quad Install Redis
Installing the Redis server
Apt-get Install Redis-server
Installation Phpredis Amplification
wget Https://github.com/nicolasff/phpredis/zipball/master-O Php-redis.zip
Unzip Php-redis.zip
Phpize
./configure
Make
Make install
Vim/etc/php5/fpm/php.ini Increase extension=redis.so
Restart PHP Services Service php5-fpm Restart
Five basic Software Installation
1. Change the Apt-get resource path
System settings, software and updates, in the package Management Center "software Source" select "Chinese server" mirros.aliyun.com can be automatically used
2. Installing Chorme
wget Https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb
sudo dpkg-i google-chrome-stable_current_i386.deb
3.phpstorm
: http://www.jetbrains.com/phpstorm/
Tar zxvf php.tar.gz
CD Catalog
CD bin
./phpstorm.sh
4.SVN Client Rabbitvcs
Add-apt-repository Ppa:rabbitvcs/ppa
Apt-key adv--keyserver keyserver.ubuntu.com--recv-keys 34ef4a35
Apt-get Update
sudo apt-get install python-nautilus python-configobj python-gtk2 python-glade2 python-svn python-dbus Python-dulwich Subversion meld
sudo apt-get install rabbitvcs-cli rabbitvcs-core rabbitvcs-gedit RABBITVCS-NAUTILUS3
4.filezilla
Apt-get Install FileZilla
Apt-get Install Filezilla-locales
5.qq
Http://www.bubuko.com/infodetail-343048.html
Ubuntu (Bantu) Web development Environment Building, common software Installation, configuration lamp (Nginx,php,mysql), common Software (Ftp,redis) and other installation