acces vhost in a virtual machine

Discussion in 'Installation/Configuration' started by jbonlinea, Oct 2, 2018.

  1. jbonlinea

    jbonlinea Member

    Hi everyone.
    I recently switched from MacOS to Debian, and I'm still sorting out my work environment.
    On MacOS I used Mamp as a web and db server, and I could create any instance I wanted to test my work on php 5.6, 7.0 or 7.1 for instance.

    In parallel, I've been using ISPConfig in production for a while now; each site could run different php version, apache headers, etc.

    Let say we have three domain name :, and all directed to MY_SERVER_IP
    and that the server has two sites, and
    if I browse or I will indeed use the websites/settings set in ISPConfig for each, while if I browse or the server will return both site but using the default server settings, and for this reason I came to create a site name 0000-defaultsite.tld in order to have a clear view of the situation and "avoid" such "issue"

    Now I installed the perfect server in a virtual box running on my new debian computer
    On my host computer, I can access the webserver on the virtual box, browsing its local IP (this tuto explains how I set it up) ;
    and I can get to ispconfig using https://Virtualbox-Local-IP:8080 or the webmail we install with http://Virtualbox-Local-IP/webmail

    However how can I acces each website created in ISPConfig ?
    As I'm in local, on the same computer (virtually) I don't use domains.
    Do I have to ? and do I have to set de DNS server to redirect *.blabla.test toward the IP of my virtual machine ?
    Isn't there any easier way ?

    Thank's in advance
  2. till

    till Super Moderator Staff Member ISPConfig Developer

  3. jbonlinea

    jbonlinea Member

    whaaa, that's absolutly excelent !

  4. jbonlinea

    jbonlinea Member


    I'm a bit confused actually
    On the host system, I added this line in /etc/hosts
    Virtualbox-local-IP being the IP of the virtual ethernet card of my virtualbox machine configured like here being the server name I defined on the virtual machine folowing the perfect server tutorial for debian stretch.

    On my host web broswer,
    •, and point toward my virtual machine, so it seems we are good, but.
    • if I create in ISPConfig a client and two sites, and
      • points properly (as above)
      • return the folowing error :SSL_ERROR_RX_RECORD_TOO_LONG ; which is probably normal since I haven't dealt with certificated and https yet
      • returns "unable to find this page" ?!
      • returns "unable to find this page" ?!
    I really don't undertand the two last cases.
    Well, I assume that I may define every single sites in /ect/hosts on my host system, but that seems sub-optimal.

    So what's the proper way forward ?

    PS : I checked and there is indeed a folder /etc/var/www/
    Last edited: Oct 2, 2018
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    You have to define all domain names that you want to use in /etc/hosts, if you don't define, then how shall the browser on your system know where to find that site.
  6. jbonlinea

    jbonlinea Member

    I tried * and * but it didn't work :-(
    well I would hope there was a way to set it for a domain and each of it's subdomains (even if I got that there is not really such thing a subdomain as they are normal domains)

    Thank's you made my day (again - but I'll probably have to bother you with http/https pretty soon)
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    The hosts file does not support wildcards. If you want to have wildcards, then you must set up a dns server, setup your custom domain there, configure the dns server to act as resolver too and then configure your desktop to use that dns server as dns resolver.
  8. jbonlinea

    jbonlinea Member

    yep, I actually use my nas as a dns server to resolve a single domain I use to sync/back-up my files,
    using a dns server was thus my first guess but I may well want to work on my virtual machine for elsewhere thant the local network the nas is, or even without internet connexion so using a dns server would imply to install it locally on my main debian install, but i think it's heavy work just to resolve few *domains.
    I'll thus edit etc/hosts for every domain/subdomain. That's kind of a pity but not a big deal.

    Thank's for your help !

    ps : is there some specific recomendation (post you could direct me to) to install/use ssl certificates on virtual machine like my setup ?
    I've seen that the perfect server tutorial for debian stretch uses cerbot so it's a good start ;-)

    ps2 : i've read the let's encrypt faq and have seen that if I'm behind a NAT I have to disable let's encrypt check from the system preferences ;-)
    Last edited: Oct 2, 2018
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    You can't use lets encrypt for such 'private' domains. LE works only for officially registered domain names and the domain must be accessible from the internet so that LE can verify the name before issuing an SSL cert.
  10. jbonlinea

    jbonlinea Member

    ok, it makes sense :)

Share This Page