Welcome to Centmin Mod Community
Register Now

Sysadmin test server

Discussion in 'System Administration' started by dooma, Jul 8, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    means you have not transferred the maindomain.com.conf vhost file yet !

    means you haven't properly rsync'd the files yet from Centmin Mod Site Data Migration Guide which lists a rsync dry run with -n flag which tests transfer without actual transfer and then rsync live run without -n flag in rsync -avzin so rsync -avzi to actually transfer data

    To read up more on rsync usage see
     
    Last edited: Jul 8, 2017
  2. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Thank you so much, I transferred the data sucessfully and I checked the xenforo files. I found it at the remote server under public/mymaindomain.com/ but when I restarted the nprestart at the remote server. I found an error and I think that's the last one ::

    Code (Text):
    nprestart
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
                                                               [FAILED]
    Gracefully shutting down php-fpm  done
    Starting php-fpm  done
    [10:45][root@1263.s.hostens.cloud ~]# nginx -t
    nginx: [warn] conflicting server name "maindomain.com" on 0.0.0.0:80, ignored
    nginx: [warn] conflicting server name "www.maindomain.com.com" on 0.0.0.0:80, ignored
    nginx: [warn] conflicting server name "maindomain.com.com" on 0.0.0.0:80, ignored
    nginx: [warn] conflicting server name "www.maindomain.com.com" on 0.0.0.0:80, ignored
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: [emerg] open() "/home/nginx/domains/maindomain.com.com/log/access.log" failed (2: No such file or directory)
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    [10:45][root@1263.s.hostens.cloud ~]# vi /usr/local/nginx/conf/nginx.conf
    


    Thanks
     
  3. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    that ain't right web files should be in web root at /home/nginx/domains/mymaindomain.com/public

    from Sysadmin - test server what output do you get for

    from live server
    Code (Text):
    ssh -p $port -i $HOME/.ssh/$privatekey root@$remoteip ls -lah /usr/local/nginx/conf/conf.d
    

    from remote/new server
    Code (Text):
    ls -lah /usr/local/nginx/conf/conf.d
    

    that is because rsync command excludes log directory from transfer so i need to revise instructions to change exclude from
    Code (Text):
     --exclude 'domains/*/log' --exclude 'domains/*/backup'
    

    to
    Code (Text):
     --exclude 'domains/*/log/*' --exclude 'domains/*/backup/*'
    


    Updated guide at Centmin Mod Site Data Migration Guide
     
    Last edited: Jul 8, 2017
  4. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Yes you are correct it's here.

    output :
    Code (Text):
    [07:55][root@cloud1 home]# remoteip=MY REMOTE IP
    [08:02][root@cloud1 home]# port=22
    [08:02][root@cloud1 home]# privatekey=my1.key
    [08:02][root@cloud1 home]# ssh -p $port -i $HOME/.ssh/$privatekey root@$remoteip ls -lah /usr/local/nginx/conf/conf.d
    total 24K
    drwxr-xr-x 2 root root 4.0K Jul  8 10:58 .
    drwxr-xr-x 6 root root 4.0K Jul  8 10:46 ..
    -rw-r--r-- 1 root root 1.1K Jul  3 02:19 demodomain.com.conf
    -rw-r--r-- 1 root root 2.2K Jul  4 09:05 maindomain.com.conf
    -rw-r--r-- 1 root root 3.3K Jul  4 23:47 maindomain.com.ssl.conf
    -rw-r--r-- 1 root root 1.4K Jul  8 06:48 virtual.conf
    
     
  5. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    for previous post missing log directory i revised guide at Centmin Mod Site Data Migration Guide with updated rsync commands

    i.e. live run from live server
    Code (Text):
    cd /home
    rsync -avzi --progress --stats -e "ssh -p $port -i $HOME/.ssh/$privatekey" --exclude 'domains/*/log/*' --exclude 'domains/*/backup/*' /home/nginx/ root@$remoteip:/home/nginx

    then should transfer log and backup directory names themselves but exclude files within them

    if you want to include log files and backup files in rsync tansfer just remove excludes
    Code (Text):
    cd /home
    rsync -avzi --progress --stats -e "ssh -p $port -i $HOME/.ssh/$privatekey" /home/nginx/ root@$remoteip:/home/nginx

    re-running command just transfers missing files so safe to do
     
  6. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    I completed that now and I think all files were moved from the main server to the remote one but the remoteIP takes me to the centminmod page not the test forums? is there another missing point ?
     
    Last edited: Jul 8, 2017
  7. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    that is correct viewing remote ip address only should direct to centmin mod main hostname page setup via getting started guide step 1

    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

    Then visit your domain name should hit new/remote server. If you use browser dev tools network tab with remote ip column enabled, you can verify whether domain access is hitting live server ip or remote/new server ip
     
  8. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    I'd like to inform you that I have now 2 servers. One is live and the other test one :D
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Excellent to hear. I bet it feels great when you accomplish and learn something new :)

    Remember the advice to keep on practicing this site migration skill.
     
  10. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Thank you. Yes I feel happy. I'm studying linux and server admin around 12 hrs per day.

    I already purchased a linode vps to transfer it again.
     
  11. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    what did you set for these values are for your remote server not source live server
    Code (Text):
    remoteip=111.222.333.444
    port=22
    comment=mykey
    remoterootpass=yourremoteserver_rootpassword
    

    BEFORE running keygen.sh ?
    if you changed remote server sshd port, you need to edit source live server's /etc/csf/csf.conf TCP_OUT and TCP6_OUT comma separated list of IPs to add the remote custom sshd port to whitelisting and whitelist the IP of remote on live server and whitelits live server IP on remote server.
     
  12. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Hello, @eva2000
    I solved it and I deleted the comment. It was IP error. :)

    I have 2 databases at my source server, can I transfer every database individually or must be the both at the same time ?
    Thanks
     
  13. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    i see

    databases can be transferred individually and recommended that way if it's on the fly importing into remote server's mysql - less chance of timeouts.
     
  14. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Hi @eva2000
    I transferred everything ( I think successfully ) but I'm getting 502 Bad Gateway nginx error when tried to go to the site after editing the hosts file. what may be the solution?

    The file /usr/local/nginx/conf/conf.d/virtual.conf has my remote server name.

    when I tried to restart nginx with php-fpm. it restarted the nginx succesfully but the fpm failed :
    failed. Use force-quit
    Code:
    Starting php-fpm /etc/init.d/php-fpm: line 69: /usr/local/sbin/php-fpm: No such file or directory
     failed
    Thanks :)
     
  15. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    that means php-fpm not installed on server. Is this a fresh 123.09beta01 install within past 24hrs ? if so you might have ran into the complications and issues with EPEL uw-imap-devel and libc-client rpm packages outlined at CentOS 7.x - Fix for Error: Package: uw-imap-devel-2007f-4.el7.1.x86_64 (@epel) which caused php-fpm to not be installed.

    If it's a test server new remote just setup and you want to practice the transfer one more time, then best to reload test remote server OS and try a fresh centmin mod 123.09beta01 install which now has the fix Beta Branch - CentOS 7 workaround fix for EPEL uw-imap-devel & libc-client issues. Then re-try your transfer process to new remote test server again. Think of it as a more practice :)
     
  16. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Starting again :D
     
  17. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    now we can move the site with it's database to another centminmod server but how can I download the site files and the databases to my laptop to ??
    thanks
     
  18. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    just use sftp with root user to download backups of your site files and database via your ftp/sftp client
     
  19. dooma

    dooma Active Member

    303
    31
    28
    Oct 15, 2016
    Cairo
    Ratings:
    +44
    Local Time:
    6:59 AM
    Hi

    The php-fpm problem still exists ! and it failed to be reloaded. the cloned site refused to be opened.

    Thanks
     
  20. eva2000

    eva2000 Administrator Staff Member

    44,483
    10,164
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,726
    Local Time:
    2:59 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    on clone site server post install log

    You'll need to post on the forums with the following info
    • Server or VPS details ? XEN, KVM, OpenVZ, VMWare or dedicated server ? OS ? CentOS 6.7 or 7.2 ? 32bit or 64bit ?
    • What version of Centmin Mod ? .07 stable or 08 stable or .09 beta01 or another branch version ?
    • Was it fresh install or upgrade ?
    • Method of install ? Via centmin.sh menu option 1, Git install or curl one liner install as outlined at centminmod.com/download.html ?
    • How long ago did you install Centmin Mod ?
    • There's numerous code changes, bug fixes over time, so ensure you have latest Centmin Mod code installed by upgrading your Centmin Mod code as instructed below.

    Troubleshooting Initial Install



    To troubleshoot initial installation, you need to check the initial install log at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the initial install log. You can see full details at How to troubleshoot Centmin Mod initial install issues

    Example list /root/centminlogs files in date ascending order and grep for install.log
    Code (Text):
    ls -lahrt /root/centminlogs | grep install.log
    

    example output returns install log at /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_install.log
    Code (Text):
    ls -lahrt /root/centminlogs | grep install.log
    -rw-r--r--  1 root root 2.2M Oct 11 01:40 centminmod_1.2.3-eva2000.09.001_111016-112321_install.log
    

    in SSH use cat to ouput contents of /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_install.log. Clear your SSH client window/buffer so only output is the contents of the file
    Code (Text):
    cat /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-112321_install.log
    

    Then copy and paste into Pastebin.com or Gists entry. If your SSH window scroll buffer isn't that large to get the whole contents of the install log, you can download file manually and copy and paste contents. But makes sure it's sanitised version of the contents of the initial install log as outlined at How to troubleshoot Centmin Mod initial install issues