Get the most out of your Centmin Mod LEMP stack
Become a Member

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:
    +162
    Local Time:
    8:34 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 Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    2:34 PM
    Nginx-1.25.x
    MariaDB 10.3.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 :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,909
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,811
    Local Time:
    10:34 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    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
     
  4. upgrade81

    upgrade81 Member

    295
    17
    18
    Sep 5, 2016
    CH
    Ratings:
    +30
    Local Time:
    1:34 PM
    1.17
    10.3
    Hello everyone, come back to this discussion because I have a similar problem.

    premise that I know well how to modify the host file and I can also use hostman.

    We are currently migrating some sites from an old server to the new one.
    Using the clone function of ManageWP - plugin, as you can see here from their guide:
    Migrate a website - ManageWP

    To migrate a site to a new server you need to provide the new IP, or a temporary url.

    The problem is that their script if we use the IP mode is to query the server on that example: 10.10.10.254/test.php and of course we find the courtesy page of personalized nginx Centminmod, and therefore can not find the files that their script copies to the FTP of the new created vhost.

    I spoke with their assistance and they suggested me to use the temporary url function, but I do not know how to implement it.

    Can someone help me?