Vagrant sets up the LNMP environment of Ubuntu
Install Vagrant and Virtualbox.
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.memory = "1024"end
The connection username and password for vagrant up waiting to install vagrant ssh are both vagrant
Vagrant Environment
sudo apt-get update
Install nginx
sudo apt-get install nginx
Set the password for installing Mysql. You can connect to Mysql through SSH during remote connection. The ssh username and password are both 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. You can modify the/vagrant directory of the ubuntu_lnmp Virtual Machine locally.
Modify/etc/php5/fpm/php. ini
cgi.fix_pathinfo = 0display_errors = Ondate.timezone = PRC
/Etc/nginx/sites-available/default Modification
Server {... // locate index. php index.html index.htm... location ~ \. Php {# fastcgi_split_path_info ^ (. + \. php )(/. +) $ ;## NOTE: You shoshould 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;} using SCRIPT_FILENAME $ document_root $ real_script_name; using SCRIPT_NAME $ real_script_name; fastcgi_param PATH_INFO $ path_info ;}}
This is to support php phpinfo. It is not very difficult to understand. The fastcgi_param configuration item name will appear in $ _ SERVER [configuration item name ].
Modify nginx User Name
sudo vi /etc/nginx/nginx.conf
Change user www-data to user vagrant;
Modify php-fpm Configuration
sudo vi /etc/php5/fpm/pool.d/www.conf
Find the following configuration item to modify
User = vagrantgroup = vagrant; listen =/var/run/php5-fpm.sock comment out to listen = 127.0.0.1: 9000listen. owner = vagrantlisten. group = vagrant
My pm. Configuration
pm.max_children = 1000pm.start_servers = 25pm.min_spare_servers = 25pm.max_spare_servers = 50pm.max_requests = 1000
To prevent the php. ini of cli and fpm from being different, you can delete the php. ini file of cli and then ln the previous
sudo rm -rf /etc/php5/cli/php.iniln -s /etc/php5/fpm/php.ini /etc/php5/cli/php.ini
In this way, you can modify a configuration file to synchronize the files on both sides.
How to Use vagrant to install a Hadoop cluster on a virtual machine
Efficient Puppet module Management in Vagrant
Use Vagrant and Fabric for Integration Testing
Build a development environment using Vagrant
Configure the Vagrant environment in Windows
Build a development environment using Vagrant
Build a virtual machine environment through Vagrant
This article permanently updates the link address: