At present, we need to develop the Laravel5.1 project based on many different uses, and distinguish it with different level two domain names.
For example, I clone two different Laravel5.1 projects A and b from GitHub, and need to configure a.xxx.com to access a project, b.xxx.com Access B project.
How do I achieve this and share the user database? Do you use a different folder and two databases, or can you merge the two projects together? If you can merge, what do you do?
Reply content:
At present, we need to develop the Laravel5.1 project based on many different uses, and distinguish it with different level two domain names.
For example, I clone two different Laravel5.1 projects A and b from GitHub, and need to configure a.xxx.com to access a project, b.xxx.com Access B project.
How do I achieve this and share the user database? Do you use a different folder and two databases, or can you merge the two projects together? If you can merge, what do you do?
The project itself is separate, i.e. your a project and project B should be two unrelated applications, even if they use the same database.
You only need to configure Apache or Nginx according to the domain name forwarding to the corresponding project is good,
For example, your a project is located in
F:zenda
For example, your B project is located in
F:zendb
Virtual machine configuration
Apache Configuration
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
AllowOverride All
# 入口文件 DirectoryIndex app.php
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
AllowOverride All
# 入口文件 DirectoryIndex app.php
Configure host again locally to
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 a.xxx.com b.xxx.com