Home >Backend Development >PHP Tutorial >How to merge two different Laravel projects?

How to merge two different Laravel projects?

WBOY
WBOYOriginal
2016-07-06 13:52:031121browse

Currently, it needs to be developed based on multiple Laravel5.1 projects with different purposes, using different second-level domain names to distinguish them.
For example, I cloned two Laravel5.1 projects A and B for different purposes from Github, and I need to configure a.xxx.com to access project A and b.xxx.com to access project B.
How to achieve this goal and share the user database? Should I use different folders and two databases, or can the two projects be merged together? If it can be merged, how to do it?

Reply content:

Currently, development needs to be based on multiple Laravel5.1 projects with different uses, and different second-level domain names are used to distinguish them.
For example, I cloned two Laravel5.1 projects A and B for different purposes from Github, and I need to configure a.xxx.com to access project A and b.xxx.com to access project B.
How to achieve this goal and share the user database? Should I use different folders and two databases, or can the two projects be merged together? If it can be merged, how to do it?

The projects themselves are separate, that is, your Project A and Project B should be two unrelated applications, even if they use the same database.

You only need to forward to the corresponding project according to the domain name when configuring apache or nginx,

For example, your A project is located at
F:Zenda

For example, your B project is located at
F:Zendb

Virtual machine configuration

Apache Configuration

<code><VirtualHost *:80>
    ServerAdmin g@godruoyi.com
    # 项目A
    DocumentRoot "F:\Zend\a"
    # 访问项目A的域名
    ServerName a.xxx.com
    ErrorLog "logs/godruoyi_ok.log"
    CustomLog "logs/godruoyi_ok.log" common
    <Directory "F:\Zend\a">
        AllowOverride All
    </Directory>
    <IfModule dir_module>
        # 入口文件
        DirectoryIndex app.php
    </IfModule>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin g@godruoyi.com
    # 项目B
    DocumentRoot "F:\Zend\b"
    # 访问项目B的域名
    ServerName b.xxx.com
    ErrorLog "logs/godruoyi_ok.log"
    CustomLog "logs/godruoyi_ok.log" common
    <Directory "F:\Zend\b">
        AllowOverride All
    </Directory>
    <IfModule dir_module>
        # 入口文件
        DirectoryIndex app.php
    </IfModule>
</VirtualHost></code>

Configure the host locally

C:WindowsSystem32driversetchosts

127.0.0.1 a.xxx.com b.xxx.com

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn