targeting dev sites with vhost setup using ngrok

paul degrand picture paul degrand · Jul 26, 2015 · Viewed 16.1k times · Source

I'm trying to tunnel a clients site in my sites directory with "ngrok http -host-header = client1.dev 80", I get a 404 when accessing the url. After some experimenting, if I put an index.html file in the home directory, it will display that file. Not sure why a file in the home directory works while files in sites directory do not. I must be missing something here..Any ideas?

directory structure :

www
  |home
  |sites
    | client1
    | client2
      ... 

vhost.conf :

<Directory "/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<Virtualhost *:80>
VirtualDocumentRoot "/Users/myname/www/home/wwwroot"
ServerName home.dev
UseCanonicalName Off
</Virtualhost>

<Virtualhost *:80>
VirtualDocumentRoot "/Users/myname/www/sites/%1/wwwroot"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
</Virtualhost>

Answer

Abdourahmane FALL picture Abdourahmane FALL · Aug 10, 2015

Cool All your config is good, You just have to exec command

ngrok http -host-header=rewrite home.dev:80

ngrok http -host-header=rewrite sites.dev:80