Use Vagrant to build a development environment and vagrant to build development

Source: Internet
Author: User

Use Vagrant to build a development environment and vagrant to build development

1. Install Oracle VM VirtualBox and vagrant. After installation is complete, restart the computer.

Oracle VM VirtualBox installation package download: https://www.virtualbox.org/wiki/Downloads

Vagrant installation package download: https://www.vagrantup.com/downloads-archive.html

 

2. Create a folder on your computer. My directory name is vagrant. Put ubuntu14.04.box and the project folder in this folder.

 

3. Enter the vagrant directory in CMD and use the vagrant box add XXX ubuntu14.04.box command to add the box

 

4. vagrant init XXX Initialization

 

5. The Vagrantfile file will appear in the vagrant folder.

 

6. Remove the comment in line 3. The IP address is the Server IP address,

 

 

7. The vagrant up command will automatically install the system and PHP environment, and the project file will appear under/vagrant.

 

 

8. Now you can connect remotely through SSH. the password of the ip 192.168.88.86 account is vagrant.

 

9. Upload the database through navicat, and the database account and password are root.

 

10. Configure the domain name, 000-defalt.conf under/etc/apache2/sites-available

 

 

11. If there are multiple domain names, sudo cp 000-default.conf 001-default.conf will continue to be modified.

 

12. Start the site sudo a2ensite 000-default.conf and restart apache

 

13. Enable rewrite Module

Method 1

A2enmod rewrite

Restart/etc/init. d/apache2 restart

Make a startup Link (automatically loaded next time) ln-s/etc/apache2/mod-available/rewrite. load/etc/apache2/mod-enabled/rewrite. load

Method 2

Sudo a2enmod rewrite enable Rewrite Module

Sudo/etc/init. d/apache2 restart

 

Go to the/etc/apache2 directory and edit the apache2.conf file.

Find the code, copy one, change the directory, change none to all, and restart apache.

 

 

14. Local IP binding

 

15. You can access the domain name normally. Then, start the server to use vagrant up and disable it.vagrant halt

 

16. Attached vagrant command:

Vagrant init initializes vagrantfile

Vagrant add box to automatically generate vagrantfile

Vagrant ssh connection to virtual machines

Vagrant halt shut down virtual machines

Vagrant destroy

Vagrant reload the vagarntfile File

View the virtual machine running status in vagrant status

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.