请如何配置和使用适用于宅基地的动态子域路由。 我在routes.php中设置了子域路由
Route::group(['domain' => '{school}.myapp.com'], function () {
Route::get('/', 'HomepageController@enterSchool');
});
答案 0 :(得分:0)
我就是这样做的。
get_person_info()
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
答案 1 :(得分:0)
请确保您更新了/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
答案 2 :(得分:0)
使用Laravel Homestead创建动态子域
对于本地开发,请将域扩展名保留为“ .test”
如果您使用的是Laravel Homestead:
在homestead.yml中将站点名称创建为 myapp.test
sites:
-map: myapp.test
to: /home/vagrant/myapp/public
wildcard: "yes"
使用“ vagrant ssh”登录到您的宅基地,然后将nginx server_name编辑为* .myapp.test
sudo vi /etc/nginx/sites-available/myapp.test
现在从宅基地退出,在本地计算机上执行以下提到的步骤。编辑主机文件,即/ etc / hosts
sudo vi /etc/hosts
192.168.10.10 *.myapp.test
现在按如下所示编辑dnsmasq文件:
sudo vi /usr/local/etc/dnsmasq.conf
在dnsmasq.conf文件中提及:
address=/test/192.168.10.10
重新启动dnsmasq服务:
[For Ubuntu users]
sudo /etc/init.d/dnsmasq restart
[For Mac users]
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
在目录“ / etc / resolver /”中创建测试文件,如下所示:
sudo vi /etc/resolver/test
nameserver 127.0.0.1 #mention this code in test file
就是这样!做完!!! 现在,您可以访问任何子域,例如:
abc.myapp.test
xyz.myapp.test
dynamicSubdomain.myapp.test
myapp.test