[Quickly and comprehensively master WAMPServer] 08. Want to play with multiple sites? You must understand the creation and use of virtual hosts

Network Management Xiaojia/sysadm.cc

Network Management Xiaojia/sysadm.cc

Sometimes, we may have several projects on hand at the same time instead of just one.

For example, like me, I need to use it for a while Wordpress, and then use it again Joomla, and then I need to use another certain system.

So can we achieve the purpose of debugging multiple projects at the same time without switching back and forth?

Ask this question and the answer will be yes.

WAMPServerThere should be two ways to achieve the above effect below .

wwwVirtual form of a shared directory

One is through the multi-project method, which is to put multiple projects in the main directory in the form of subfolders wamp(64)/www.

The form is like this:

wamp(64)
  |-- www
       |-- Project1
       |-- Project2
       |-- etc

When using this method, we must 域名/子目录access it in the form of a link.

For Project1example, it should be accessed like this.

http://localhost/Project1/

Note that localhostit can also be other domain names. In addition, Project1the subdirectories must pay attention to the upper and lower case of English letters.

wamp(64)/wwwIt's very easy to put the project directly into .

It is based on the default DocumentRootsetting of c:/wamp(64)/www/.

DocumentRoot "c:/wamp(64)/www/"

As long as you put the project folder in, you can access it as a domain name plus a subdirectory. We don't need to do any additional actions.

However, this method also has shortcomings in addition to convenience. For example, it may be incompatible with certain configurations in the actual production environment.

For example, in an actual production environment, for a project, the root directory should be / .

In the case of adding a domain name and subdirectories, its root directory becomes /子目录/. Obviously, this will cause some serious path access compatibility issues.

A stark and popular example, is Laravel.

In order to improve security, Laravel usually allows users to access /publicthe root directory instead of directly accessing it.

If we use 域名/子目录the form, then Laravelthe access becomes something like localhost/xxxx/publicthis.

Although it has no special impact on debugging programs, when migrating to a production environment, modifying the configuration becomes a minor trouble.

Fortunately, we have another method...


Follow Xiaojia, the network administrator, to view all collection contents!

"[Necessary series for beginners to get started with PHP] Quickly and comprehensively master WAMPServer" tutorial list:

[Quickly and comprehensively master WAMPServer] 01. First time meeting, please take care of me

[Quickly and comprehensively master WAMPServer] 02. Things you must know before intimate contact

[Quickly and comprehensively master WAMPServer] 03. Play with installation and upgrades

[Quickly and comprehensively master WAMPServer] 04. First experience in life

[Quickly and comprehensively master WAMPServer] 05. Understand Apache

[Quickly and comprehensively master WAMPServer] 06. Understand PHP

[Quickly and comprehensively master WAMPServer] 07. Understand MySQL and MariaDB

[Quickly and comprehensively master WAMPServer] 08. If you want to play multiple sites, you must understand the creation and use of virtual hosts

[Quickly and comprehensively master WAMPServer] 09. How to install Composer in WAMPServer

[Quickly and comprehensively master WAMPServer] 10. In the HTTP2.0 era, let WampServer enable SSL!

[Quickly and comprehensively master WAMPServer] 11. Pitfalls encountered when installing PHP extensions

[Quickly and comprehensively master WAMPServer] 12. Summary of WAMPServer troubleshooting experience

[Quickly and comprehensively master WAMPServer] 13. Are you having trouble debugging PHP? Ask xDebug to help!

[Quickly and comprehensively master WAMPServer] 14. Upgrading methods of various components

Network Management Xiaojia/sysadm.cc

Guess you like

Origin blog.csdn.net/kydd2008/article/details/135282175