为子域路由配置宅基
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为子域路由配置宅基相关的知识,希望对你有一定的参考价值。
请如何配置和使用在宅基地上运行的dynamic子域路由。我已经在routes.php中设置了子域路由
Route::group(['domain' => '{school}.myapp.com'], function () {
Route::get('/', 'HomepageController@enterSchool');
});
答案
这是我的方法。ip: "192.168.10.10"
memory: 8192
cpus: 1
folders:
- map: path/to/application/repository_name_one
to: /home/vagrant/Code/repository_name_one
sites:
- map: repository_name_one.dev
to: /home/vagrant/Code/repository_name_one/public
- map: subdomain.repository_name_one.dev
to: /home/vagrant/Code/repository_name_one/public
Route::group(
[
'domain' => 'subdomain.repository_name_one.dev'
],
function () {
[...]
}
);
另一答案
确保您更新/etc/hosts
以添加子域。Homestead.yaml
ip: "192.168.10.10"
memory: 8192
cpus: 1
folders:
- map: path/to/application/repository_name_one
to: /home/vagrant/Code/repository_name_one
sites:
- map: repository_name_one.dev
to: /home/vagrant/Code/repository_name_one/public
- map: subdomain.repository_name_one.dev
to: /home/vagrant/Code/repository_name_one/public
/ etc / hosts
192.168.10.10 myapp.com
192.168.10.10 school.myapp.com
以上是关于为子域路由配置宅基的主要内容,如果未能解决你的问题,请参考以下文章