Vagrant 如何漫游scotchbox子域虚拟主机

Vagrant 如何漫游scotchbox子域虚拟主机,vagrant,apache2,localhost,subdomain,virtual-hosts,Vagrant,Apache2,Localhost,Subdomain,Virtual Hosts,我已经从scotch.io安装了vagrant和scotchbox,以便在本地开发,并且运行得很好。 现在我需要使用子域作为变量,我已经在谷歌上搜索过了,但仍然没有工作。 我已经更改了hosts文件并添加了 192.168.33.10 scotch.box 是否需要为通配符子域主机添加一行? 我还将下一行添加到conf文件中 <VirtualHost *:80> DocumentRoot /var/www/public ServerName tenant.scot

我已经从scotch.io安装了vagrant和scotchbox,以便在本地开发,并且运行得很好。 现在我需要使用子域作为变量,我已经在谷歌上搜索过了,但仍然没有工作。 我已经更改了hosts文件并添加了

192.168.33.10  scotch.box
是否需要为通配符子域主机添加一行? 我还将下一行添加到conf文件中

<VirtualHost *:80>
    DocumentRoot /var/www/public
    ServerName tenant.scotch.box
    ServerAlias *.scotch.box
</VirtualHost>

DocumentRoot/var/www/public
ServerName tenant.scotch.box
ServerAlias*.scotch.box
对不起,我的英语不好。

只需添加 192.168.33.10租户。苏格兰威士忌。盒子
致主持人。

几个月前我也遇到了同样的问题。在托管操作系统上,您必须编辑主机文件。 在窗户上

C:\Windows\System32\drivers\etc\hosts
在linux上

sudo nano /etc/hosts
然后,您必须使用所需的主机名添加scotch box的ip地址

192.168.33.10 tenant.scotch.box
如果您有多个子域或在同一个透明框上开发多个web应用程序,甚至可以向主机文件添加多行。例如:

192.168.33.10 sub1.scotch.box
192.168.33.10 sub2.scotch.box
192.168.33.10 sub3.scotch.box
但是不要忘记编辑Scotch Box中的虚拟主机文件,该文件位于
/etc/apache2/sites available/YOUR_CONFIG.conf

每个子域都需要一个
。例如:

<VirtualHost *:80>
  DocumentRoot /var/www/public
  ServerName sub1.scotch.box
  ServerAlias *.scotch.box
</VirtualHost>

DocumentRoot/var/www/public
ServerName sub1.scotch.box
ServerAlias*.scotch.box