Discover Centmin Mod today
Register Now

Check site how it looks using hosts before change dns

Discussion in 'Centmin Mod Insights' started by pamamolf, Jul 7, 2014.

  1. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hi

    Can you please post an example on what i must add on /etc/hosts so i can see how it looks the site before i do the dns change on the domain to the new ip?

    Example:

    Code:
    server ip: 123.456.789.000
    domain: mydomain.com
    
    Thanks :)
     
    Last edited: Jul 7, 2014
  2. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    who's doing the checking ? yourself ?

    for me on my windows pc when i want to check pre-dns changes i edit C:\Windows\System32\drivers\etc\hosts file and clear browser cache if needed

    Code:
    newipaddress domainname.com
     
    • Like Like x 1
  3. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Yes i want to check how it looks the site before i change the domain A record.

    I am on Centos :)

    For example after transfering a site to a news server i want to check if it works or have any errors before i change the A record ...
     
  4. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    on CentOS just same contents/line different file = /etc/hosts
     
  5. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    And then browsing using the ip?
     
  6. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    on the pc with host file edit, just browse using your browser i.e. chrome, internet explorer, firefox etc :)
     
  7. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Remotely is not possible?

    As now i can see the content from /usr/local/nginx/public/ using the server ip.....
    Is tehre any edit to be able to view the /home/nginx/mydomain.com/public/ using the server ip?
     
  8. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    it should already do that if you have in your /etc/hosts file and access mydomain.com from your browser (accessing newipaddress from browser will always go to hostname's /usr/local/nginx/html as intended)

    Code:
    newipaddress mydomain.com
    and have mydomain.com setup on your newipaddress Centmin Mod server via centmin.sh menu option 2
     
  9. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Yes i have already add the host from the menu and upload some files there and the database.

    Now i must edit on the server the /etc/hosts and add:

    Code:
    123.456.789.000    mydomain.com
    And then browse from my pc using :

    Code:
    http://123.456.789.000/
    Correct?
     
  10. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    browse from mydomain.com with /etc/hosts edit in place.. browser uses your system dns to resolve mydomain.com which it looks for at /etc/hosts first
     
  11. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    so i must do this edit on my pc and on server also?

    confused.

    my pc hosts :

    Code:
    123.456.789.000    mydomain.com
    server hosts:

    Code:
    123.456.789.000    mydomain.com
    and then browse for my pc :

    Code:
    http://mydomain.com/ 
    ?
     
  12. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    only on pc

    editing on newipaddress server is optional
     
  13. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Yes but editing my host using:

    123.456.789.000 mydomain.com

    I will be able to view the nginx test page using mydomain.com and not the server ip 123.456.789.000 and this is not big deal and not what i ask :)

    Sorry for my bad english !!!!

    What i ask is :

    When i add a new vhost from the menu (domain.com) and upload the files and add the database also to be able to view if that site (and not the default test nginx page) looks like before i change my A Record.
     
  14. eva2000

    eva2000 Administrator Staff Member

    28,935
    6,567
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,747
    Local Time:
    4:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    what i listed above is what you need to do what you're asking

    on pc that you use your browser from to visit mydomain.com, edit /etc/hosts file pointing newipaddress to mydomain.com. Then any time you visit via your pc's browser mydomain.com, it looks to newipaddress and directs you to mydomain.com on newipaddress server. Provided your newipaddress server has setup mydomain.com via centmin.sh menu option 2, it should show your mydomain.com site copy from newipaddress. Only time it shows nginx setup page, is if did not setup mydomain.com on menu option 2 and/or if you setup mydomain.com on a 2nd newipaddress which you did not edit your newipaddress mydomain.com.conf nginx vhost for i.e. listen 2ndnewipaddress 80; as per https://community.centminmod.com/th...-for-every-vhost-on-centminmod.658/#post-2997
     
    Last edited: Jul 7, 2014
    • Like Like x 1
  15. pamamolf

    pamamolf Well-Known Member

    2,487
    229
    63
    May 31, 2014
    Ratings:
    +390
    Local Time:
    9:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Ok thanks i will try it :)