Welcome to Centmin Mod Community
Become a Member

Sysadmin [Oracle VM Box] How i can access on localhost for created vhost

Discussion in 'System Administration' started by Dnyan, Jun 25, 2020.

  1. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:20 AM
    1.17.8
    10.3.22
    Hello,

    I installed Oracle VM and CentOS 7 minimal on my windows computer.
    After that i did installed centminmod on it and also created vhost for say mytest (http://mytest). after creation for FTP - it shows my IP address.

    When i go to http://localhost or 127.0.0.1 or localhost.localdomain in browser, its accessing the default page which is set as main host.

    but how i could access to my crated domain http://mytest from browser, i have not yet installed or uploaded anything to that directory.

    do i need to add anything to etc/hosts in centOS or in my windows host file to make it work.

    I want to access http://mytest locally from browser.

    Kindly guide me on how i could do that.

    Thank You
     
  2. eva2000

    eva2000 Administrator Staff Member

    44,804
    10,216
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,834
    Local Time:
    2:50 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    You go to the local LAN IP address if you want to access main hostname created by Centmin Mod for your virtualbox network but it depends on how you configured the network adapter cards. Best place to ask for virtualbox setup is at virtualbox.org • Index page :)

    For test domains, yes edit your CentOS server /etc/hosts and your local PC's host file too. If you want to preview newdomain.com on new centminmod server without updating DNS, on Windows PC edit your windows HOSTS file at c:\Windows\System32\Drivers\etc\hosts (see guide at Modify your hosts file | Knowledge Center | Rackspace Hosting or install Hostman app HostsMan which can manage the file too and allows easy dns flushing when you make changes to the hosts file.

    c:\Windows\System32\Drivers\etc\hosts contents to preview without DNS update
    Code:
    centminmodserver-ip-address newdomain.com
    to disable preview comment it out and flush dns for your system
    Code:
    #centminmodserver-ip-address newdomain.com
    Hostsman app to flush dns and edit the c:\Windows\System32\Drivers\etc\hosts file

    And for MacOS users there's How to edit your Mac's Hosts file and why you would want to
     
  3. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:20 AM
    1.17.8
    10.3.22
    Do i need to use ip address assign by my ISP or can simply assign

    127.0.0.1 mytest

    or

    127.0.0.1 mytest.com (when host created with .com)

    currently i am able to access main host (localhost) nginx test page at 127.0.0.1
     
  4. eva2000

    eva2000 Administrator Staff Member

    44,804
    10,216
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,834
    Local Time:
    2:50 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    you use the IP of your local Virtualbox server which may not be 127.0.0.1, depends on how you conifgured virtualbox network adpatoprs, I have 1 bridge + 1 NAT for my virtualbox guest so it assigns a local LAN i.p just like it would if you connected your mobile, laptop or tablet to your local LAN wifi router i.e. 192.168.0.xxx
     
  5. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:20 AM
    1.17.8
    10.3.22
    Yes but on that ip too (192.168.xxx.xxx), its opening . Main host page and not my vhost which is http://mytest
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,804
    10,216
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,834
    Local Time:
    2:50 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    that's why you need to edit your local /etc/hosts on server and your local PC to point to it

    example if centos virtualbox server assigned 192.168.0.13 via local LAN router/wifi router then host file edit would be
    Code (Text):
    192.168.0.13 mytest.com mytest

    to tell mytest.com and mytest to point to 192.168.0.13
     
  7. Dnyan

    Dnyan Member

    95
    19
    8
    Sep 16, 2017
    Ratings:
    +26
    Local Time:
    10:20 AM
    1.17.8
    10.3.22
    Ok will try it Tonight, i haven't added that in my PC host file.