Want more timely Centmin Mod News Updates?
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

    106
    24
    18
    Sep 16, 2017
    Ratings:
    +36
    Local Time:
    8:29 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

    55,245
    12,253
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,833
    Local Time:
    12:59 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    106
    24
    18
    Sep 16, 2017
    Ratings:
    +36
    Local Time:
    8:29 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

    55,245
    12,253
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,833
    Local Time:
    12:59 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    106
    24
    18
    Sep 16, 2017
    Ratings:
    +36
    Local Time:
    8:29 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

    55,245
    12,253
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,833
    Local Time:
    12:59 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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

    106
    24
    18
    Sep 16, 2017
    Ratings:
    +36
    Local Time:
    8:29 AM
    1.17.8
    10.3.22
    Ok will try it Tonight, i haven't added that in my PC host file.