我已经安装了scotch.io的流浪汉和scotchbox在本地开发,并且运行得很好。现在我需要使用子域作为变量,我已经搜索过了,但仍然没有工作。我已经更改了hosts文件并添加了
192.168.33.10 scotch.box是否需要为通配符子域主机添加一行?另外,我在conf文件中添加了下一行代码
<VirtualHost *:80>
DocumentRoot /var/www/public
ServerName tenant.scotch.box
ServerAlias *.scotch.box
</VirtualHost>对不起,我的英语说得不好。
发布于 2017-04-11 20:40:18
只需将192.168.33.10 tenant.scotch.box添加到主机即可。
发布于 2017-09-07 04:17:02
几个月前我也遇到过同样的问题。在托管操作系统上,您必须编辑hosts文件。在Windows上
C:\Windows\System32\drivers\etc\hosts在linux上
sudo nano /etc/hosts然后,您必须将scotch box的ip地址与所需的主机名一起添加
192.168.33.10 tenant.scotch.box如果你有多个子域,或者在同一个scotch box上开发多个web应用程序,你甚至可以在你的hosts文件中添加多行。例如:
192.168.33.10 sub1.scotch.box
192.168.33.10 sub2.scotch.box
192.168.33.10 sub3.scotch.box但不要忘了编辑位于/etc/apache2/sites-available/YOUR_CONFIG.conf中的Scotch内的虚拟主机文件
每个子域都需要一个<VirtualHost *:80> </VirtualHost>。示例:
<VirtualHost *:80>
DocumentRoot /var/www/public
ServerName sub1.scotch.box
ServerAlias *.scotch.box
</VirtualHost>https://stackoverflow.com/questions/36704850
复制相似问题