Vagrant set up mapping directory to address environmental compatibility issues

Source: Internet
Author: User

Children's shoes with vagrant virtual machines should know that the native and virtual machine directory mappings can be defined in the Vagrantfile file, such as:

Config.vm.synced_folder ". /WebSite ","/usr/share/nginx/html "

Indicates that the website directory in the current file directory of this machine is mapped to the specified directory of the virtual machine, so that the contents of the directory in the virtual machine are website directories, that is, the directory share is implemented.


This article does not describe how to specify a synchronization directory in Vagrantfile, but instead use catalog mapping to resolve a development environment and local environment compatibility issues.

such as the code for the project on the test server:

Php

Added by MAQG 20100317 Please configure the vip_center and ADMIN_VIP paths according to the situation
$system _folder_vip_prefix = "/data/vhosts/dynamic.xxx.com/";
$system _folder_admin_prefix = "/data/vhosts/admin.vip_center/";

This is a very old project, from the code comments look at 09 years began to build, due to historical reasons, many places are not standard. The path here is written dead, many places are, and the test server file organization is very messy, and some with a chain of soft links to the local, not according to the server directory to build a set of the same, then use Vagrantfile Sync directory can skillfully solve this problem.

For example, the test server dynamic.xxx.com directory files, then the local is in the BBB directory, so you can create a mapping directory in the Vagrantfile file, the dynamic.xxx.com directory map to the local BBB directory, so that in the virtual machine or the original path, but you can access This machine's BBB directory, not to modify the code path to solve the problem?

Similarly, in other places, such a mapping directory, you can not modify the code to achieve the code in different environments compatible.

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.