1

I have installed vagrant and scotchbox from scotch.io to develop locally and is running like a charm. Now I need use the subdomains as variable, and i have googled about, but still no working. I have changed the hosts file and added

192.168.33.10  scotch.box

Is needed add a line for wildcard subdomain hosts? Also I have added the next line to my conf file

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

Sorry for my broken english.

iLevi
  • 936
  • 4
  • 10
  • 26

2 Answers2

1

Just add 192.168.33.10 tenant.scotch.box to hosts.

Sebastian
  • 11
  • 2
1

I had the same problem a couple of months ago. On the hosting OS you have to edit the hosts file. On Windows

C:\Windows\System32\drivers\etc\hosts

On linux

sudo nano /etc/hosts

you have then to add the ip-address of your scotch box with the desired host name

192.168.33.10 tenant.scotch.box

You can even add multiple lines to your hosts file if you have multiple subdomains or you are developing multiple web applications on the same scotch box. For example :

192.168.33.10 sub1.scotch.box
192.168.33.10 sub2.scotch.box
192.168.33.10 sub3.scotch.box

BUT don't forget to edit the virtual host file inside Scotch Box which is located /etc/apache2/sites-available/YOUR_CONFIG.conf

You will need a <VirtualHost *:80> </VirtualHost> for each sub domain. Example:

<VirtualHost *:80>
  DocumentRoot /var/www/public
  ServerName sub1.scotch.box
  ServerAlias *.scotch.box
</VirtualHost>
Peshmerge
  • 1,024
  • 1
  • 14
  • 27