Vagrant setting up Ubuntu's LNMP environment

Source: Internet
Author: User
Tags configuration php fpm mcrypt

Install vagrant and VirtualBox. This does not say much, after installing the two software, in a free hard disk partition

mkdir ubuntu_lnmpvagrant Init ubuntu/trusty64

Open Vagrantfile to open these two configurations

Config.vm.network "Private_network", IP: "192.168.10.10" Config.vm.provider "VirtualBox" do |vb| # Display The VirtualBox GUI when booting the machine # Vb.gui = true # Customize The amount of memory on the VM:vb.me Mory = "1024x768" End

Vagrant up waiting to install vagrant SSH connection user name and password are vagrant

Vagrant Environment is done.

sudo apt-get update

Installing Nginx

sudo apt-get install Nginx

Install MySQL Please set the password, in the remote connection, you can use SSH connection, SSH username and password are vagrant

sudo apt-get install mysql-server mysql-client Libmysqlclient-dev

Install Git version control

sudo apt-get git

Install PHP and related modules

sudo apt-get install php5-fpm php5-mysql php5-cli php5-gd php5-memcache php5-memcached php5-json php5-mcrypt php5-curl php -pear build-essential php5-dev-ysudo pecl install Xdebug-ysudo php5enmod jsonsudo php5enmod mcrypt

Delete/usr/share/nginx/html

sudo ln-s/vagrant/usr/share/nginx/html

Note: The/vagrant directory here is actually the UBUNTU_LNMP directory you created earlier, and you can also synchronize the/vagrant directories in your locally modified UBUNTU_LNMP virtual machine

Modify/etc/php5/fpm/php.ini

Cgi.fix_pathinfo = 0display_errors = Ondate.timezone = PRC

/etc/nginx/sites-available/default Modify

server {    ...    //found index    index . index.php index.html index.htm    ...    location ~  \.php {        #        fastcgi_split_path_info ^ (. +\.php) (/.+) $;        #        # NOTE: You should have  "cgi.fix_pathinfo = 0 ;"  in php.ini        #         #       # With php5-cgi alone:                 fastcgi_pass 127.0.0.1:9000 ;        #       # with  Php5-fpm:        #       fastcgi_pass unix:/var/run/ php5-fpm.sock;                 fastcgi_index index.php;                 include fastcgi_params;                 set  $pathinfo   "";                 set  $real _script_name  $fastcgi _script_name;                 if  ($ fastcgi_script_name ~  "^ (. +?\.php) (/.+) $")  {                     set  $real _script_name $1;                     set  $path _info $ 2;                }                 fastcgi_param  script_filename  $document _root$real_script_name;                 fastcgi_param SCRIPT_NAME  $real _script_name;                 fastcgi_param path_ info  $path _info;    }}

This is to support PHP's phpinfo. It's not hard to understand, Fastcgi_param configuration item name appears in $_server[configuration item name]

Modify the user name of Nginx

sudo vi/etc/nginx/nginx.conf

Find the user www-data; change to user vagrant;

Modify Configuration PHP-FPM Configuration

sudo vi/etc/php5/fpm/pool.d/www.conf

Locate the following configuration item modifications

user = Vagrantgroup = Vagrant;listen =/var/run/php5-fpm.sock Comment is changed to listen = 127.0.0.1:9000listen.owner = vagrantlisten.gr OUP = vagrant

My PM. Related configurations

Pm.max_children = 1000pm.start_servers = 25pm.min_spare_servers = 25pm.max_spare_servers = 50pm.max_requests = 1000

To prevent the php.ini of the CLI and fpm from being different, it is possible to speak the CLI's php.ini file for deletion and then ln past a

sudo rm-rf/etc/php5/cli/php.iniln-s/etc/php5/fpm/php.ini/etc/php5/cli/php.ini

This modifies a configuration file so that it can be synchronized on both sides.


Vagrant setting up Ubuntu's LNMP environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.