Learn about Centmin Mod LEMP Stack today
Register Now

Sysadmin temporary URL

Discussion in 'System Administration' started by dorobo, Mar 17, 2017.

  1. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +161
    Local Time:
    4:41 PM
    latest
    latest
    As far as I know, in control panels like cPanel and Directadmin you are given temporary URLs while waiting for your domain to propagate and also for you to test your vhost directory if it loads without errors before you change nameservers.

    Is that easy to implement in centminmod?
     
  2. pamamolf

    pamamolf Well-Known Member

    2,539
    231
    63
    May 31, 2014
    Ratings:
    +394
    Local Time:
    11:41 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    You can do that by editing the hosts file like:

    Code:
    newserveip  www.domaintotest.com
    Keep in mind that you must edit it as an Administrator.

    windows path:

    Code:
    C:\Windows\System32\drivers\etc\hosts
    Now if you need something like cpanel offers (~username) then you must wait for eva2000 to reply :)
     
    • Agree Agree x 1
    • Informative Informative x 1
  3. eva2000

    eva2000 Administrator Staff Member

    29,053
    6,594
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,790
    Local Time:
    6:41 PM
    Nginx 1.13.x
    MariaDB 5.5
    Isn't that feature in cpanel flagged as a potentially security issue ? Don't recall exactly myself. But probably not something you'd want to do.

    Better option is local host files edit like @pamamolf suggested

    To preview domain site, just setup the domains you want via centmin.sh menu option 2 as outlined at Nginx Vhost & NSD DNS Setup - CentminMod.com LEMP Nginx web stack for CentOS They aren't live unless you edit your domain's DNS to point to centminmod server's IP address so will no interfere with your live domain operation.

    Then edit each domain's vhost file at /usr/local/nginx/conf/conf.d/newdomain.com.conf and /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf (if you set yes to ssl) and add to server_name listing additional domain names you want to test from i.e. test.newdomain.com.

    would change from

    Code:
    server {
      server_name newdomain.com www.newdomain.com;
    to

    Code:
    server {
      server_name newdomain.com www.newdomain.com test.newdomain.com;
    then only update DNS for test.newdomain.com to point to centminmod server's IP address. Then after testing is done and you want to switch live domain to centminmod copy, just update DNS for newdomain.comto point to centminmod server's IP address as well :)

    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 - abelhadigital.com 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
     
    • Informative Informative x 1