Move virtual server to another server

Is there any way to move a virtual host directly to another server. I have root account and both server use custom port (different with 22). Do I need to delete the existed virtual server (I created the same one there) in the destination server?

Thanks, Giang Anh

Status: 
Active

Comments

Howdy -- it is possible to migrate a Virtual Server to a new server.

To do that, you can create a backup of your existing Virtual Server, copy that backup to your new server, and restore it on the new server.

A simple way to do that would be to use the "Transfer Virtual Server" option in Server Configuration.

In the "Hostname of destination system" field, you can add a custom SSH port by using a hostname like the following:

example.com:2222

Yes, you would need to remove the Virtual Server from the destination server first.

Unfortunately, unless backups are working, the above won't work properly.

The "Transfer Virtual Server" option just performs a backup, copy, and restore for you. It's the same as doing the steps manually, except that it performs all the steps for you.

Hi,

I was able to move the virtual server from Apache server to nginx server by manually move the public_html director and MySQL. However, after moving, my site cannot connect anymore, it shows: ERR_CONNECTION_TIMED_OUT message. http://jplay.tv

Do I need to config any special setting?

Thanks, Giang Anh

When I do a DNS lookup on that domain, it shows it pointing to the IP "23.97.59.121", is that correct?

Also, when looking in the access logs for your domain in $HOME/logs/access_log (on the new server), do you see the incoming connection attempt?

And if so, is there an error in $HOME/logs/error_log?

23.97.59.121 is correct. Yes there are incoming connection attempts. There are errors:

2015/08/20 09:09:13 [error] 1582#0: *10008 open() "/home/jplay/public_html/categories/live-stream/captain-strike/summit1g" failed (2: No such file or directory), client: 180.76.15.18, server: jplay.tv, request: "GET /categories/live-stream/captain-strike/summit1g HTTP/1.1", host: "dev.jplay.tv"
2015/08/20 09:10:23 [error] 1582#0: *10012 client intended to send too large body: 15411981 bytes, client: 115.79.47.73, server: jplay.tv, request: "POST /phpmyadmin/import.php HTTP/1.1", host: "jplay.tv", referrer: "http://jplay.tv/phpmyadmin/index.php?db=jplay&target=db_import.php&token=ceb0455e4436143e94b3f9708d9357d5#PMAURL-2:db_import.php?db=jplay&table=&server=1&target=&token=ceb0455e4436143e94b3f9708d9357d5"
2015/08/20 09:17:38 [error] 1582#0: *10052 open() "/home/jplay/public_html/muieblackcat" failed (2: No such file or directory), client: 94.102.52.174, server: jplay.tv, request: "GET /muieblackcat HTTP/1.1", host: "23.97.59.121"
2015/08/20 10:39:54 [error] 1582#0: *10271 open() "/home/jplay/public_html/rom-0" failed (2: No such file or directory), client: 46.172.71.251, server: jplay.tv, request: "GET /rom-0 HTTP/1.1", host: "23.97.59.121"
2015/08/20 11:19:24 [error] 1582#0: *10401 open() "/home/jplay/public_html/favicon.ico" failed (2: No such file or directory), client: 115.79.47.73, server: jplay.tv, request: "GET /favicon.ico HTTP/1.1", host: "jplay.tv", referrer: "http://jplay.tv/"
2015/08/20 11:25:45 [error] 1582#0: *10429 upstream sent invalid status "0 Facebook needs the CURL PHP extension." while reading response header from upstream, client: 10.0.0.5, server: jplay.tv, request: "GET / HTTP/1.0", upstream: "fastcgi://unix:/var/php-nginx/143979903845399.sock/socket:", host: "www.jplay.tv"
2015/08/20 11:31:48 [error] 1582#0: *10450 open() "/home/jplay/public_html/categories/football-stadium" failed (2: No such file or directory), client: 66.249.79.72, server: jplay.tv, request: "GET /categories/football-stadium?task=mediaform.meta&return=aHR0cDovL2Rldi5qcGxheS50di9jYXRlZ29yaWVzL3Nwb3J0cy9mb290YmFsbC1zdGFkaXVtP1BhZ2VTcGVlZD1ub3NjcmlwdA==&bbce467ddf9b34da0dfb314b9a9f0504=1&tmpl=component&PageSpeed=noscript HTTP/1.1", host: "dev.jplay.tv"
2015/08/20 13:04:11 [error] 1583#0: *10705 open() "/home/jplay/public_html/manager/html" failed (2: No such file or directory), client: 222.186.190.148, server: jplay.tv, request: "GET /manager/html HTTP/1.1", host: "23.97.59.121:80"
2015/08/20 13:13:16 [error] 1583#0: *10734 open() "/home/jplay/public_html/vi/game/mediaitem/anime-arena-hack-ios-and-android-mod-proof" failed (2: No such file or directory), client: 66.249.79.107, server: jplay.tv, request: "GET /vi/game/mediaitem/anime-arena-hack-ios-and-android-mod-proof HTTP/1.1", host: "jplay.tv"
2015/08/20 14:42:22 [error] 1583#0: *10956 open() "/home/jplay/public_html/games/clash-of-allstars" failed (2: No such file or directory), client: 66.249.79.119, server: jplay.tv, request: "GET /games/clash-of-allstars HTTP/1.1", host: "jplay.tv"
2015/08/20 15:22:32 [error] 1583#0: *11067 open() "/home/jplay/public_html/categories" failed (2: No such file or directory), client: 66.249.79.84, server: jplay.tv, request: "GET /categories?task=mediaform.meta&id=42&return=aHR0cDovL2Rldi5qcGxheS50di9jYXRlZ29yaWVzL2J1c2luZXNzL2J1aWxkaW5ncw==&1646c353ff061f1b5a68942b899af474=1&tmpl=component&PageSpeed=noscript HTTP/1.1", host: "dev.jplay.tv"

Well, I see a few different errors that your application is giving.

However, one in particular that stands out is that it's missing the PHP Curl module.

You may want to try installing the PHP Curl package and see if that helps.

Hi,

I installed it but there is no new error created.

Thanks, Giang Anh

Could you try setting up a new test domain on this server, just to see if that works properly?

In that new domain, Just add in a simple HTML file or PHP script to see if the web server is properly answering queries.

Hmm, if it's trying to answer incoming requests on port 80 with SSL, then it definitely sounds like there is a configuration problem.

Do you know if any changes were made to the Nginx config from the default?

Also, what distro/version is it that this new server is running on?

Hi,

I don't change any setting since you told me that you don't support unofficial package in the last ticket. I'm using Ubuntu 14.04.3 Also, I installed SSL in one of my virtual server: jplay.tv

Okay, what is the output of these commands:

ps auxw | grep nginx
dpkg -l 'nginx*'
netstat -anlp | grep :80

Here:

root@JPlaySite:~# ps auxw | grep nginx
root      1483  0.0  0.0  86616  2928 ?        Ss   08:21   0:00 nginx: master process /usr/sbin/nginx
www-data  1484  0.0  0.0  86616  3656 ?        S    08:21   0:00 nginx: worker process
www-data  1485  0.0  0.0  86616  3656 ?        S    08:21   0:00 nginx: worker process
www-data  1486  0.0  0.0  86616  3656 ?        S    08:21   0:00 nginx: worker process
www-data  1487  0.0  0.0  86616  5644 ?        S    08:21   0:00 nginx: worker process
jplay     2736  0.0  0.0  25092  5528 ?        S    08:21   0:00 /usr/bin/perl /usr/bin/php-loop.pl /usr/bin/php5-cgi -b /var/php-nginx/143979903845399.sock/socket
jplayvn   2744  0.0  0.0  25092  5688 ?        S    08:21   0:00 /usr/bin/perl /usr/bin/php-loop.pl /usr/bin/php5-cgi -b /var/php-nginx/143980241848201.sock/socket
anh       2752  0.0  0.0  25096  5548 ?        S    08:21   0:00 /usr/bin/perl /usr/bin/php-loop.pl /usr/bin/php5-cgi -b /var/php-nginx/14400900274362.sock/socket
jplayvn   2760  0.0  0.3 292628 22868 ?        Ss   08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143980241848201.sock/socket
anh       2761  0.0  0.3 288280 22768 ?        Ss   08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/14400900274362.sock/socket
jplay     2763  0.0  0.3 288280 22676 ?        Ss   08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143979903845399.sock/socket
jplayvn   2767  0.0  0.0 292628  4820 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143980241848201.sock/socket
jplayvn   2768  0.0  0.0 292628  4820 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143980241848201.sock/socket
jplayvn   2769  0.0  0.0 292628  4820 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143980241848201.sock/socket
anh       2770  0.0  0.0 288280  4748 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/14400900274362.sock/socket
jplayvn   2771  0.0  0.0 292628  4820 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143980241848201.sock/socket
anh       2772  0.0  0.0 288280  4748 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/14400900274362.sock/socket
anh       2773  0.0  0.0 288280  4748 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/14400900274362.sock/socket
anh       2774  0.0  0.0 288280  4748 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/14400900274362.sock/socket
jplay     2775  0.0  0.0 288280  4744 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143979903845399.sock/socket
jplay     2776  0.0  0.0 288280  4744 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143979903845399.sock/socket
jplay     2777  0.0  0.0 288280  4744 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143979903845399.sock/socket
jplay     2778  0.0  0.0 288280  4744 ?        S    08:21   0:00 /usr/bin/php5-cgi -b /var/php-nginx/143979903845399.sock/socket
root      3641  0.0  0.0  10472  2192 pts/0    S+   08:44   0:00 grep --color=auto nginx
root@JPlaySite:~# dpkg -l 'nginx*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  nginx          1.4.6-1ubunt all          small, powerful, scalable web/pro
ii  nginx-common   1.4.6-1ubunt all          small, powerful, scalable web/pro
ii  nginx-core     1.4.6-1ubunt amd64        nginx web/proxy server (core vers
un  nginx-doc      <none>       <none>       (no description available)
un  nginx-extras   <none>       <none>       (no description available)
un  nginx-full     <none>       <none>       (no description available)
un  nginx-light    <none>       <none>       (no description available)
un  nginx-naxsi    <none>       <none>       (no description available)
root@JPlaySite:~# netstat -anlp | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1483/nginx
tcp        0      0 10.0.0.5:56180          168.63.129.16:80        TIME_WAIT   -
tcp        0      0 10.0.0.5:56186          168.63.129.16:80        TIME_WAIT   -
tcp        0      0 10.0.0.5:56183          168.63.129.16:80        TIME_WAIT   -
tcp6       0      0 :::80                   :::*                    LISTEN      1483/nginx
root@JPlaySite:~#

Hi,

I worked now with https links. If I use http link it still shows the error. I don't know why it works actually.

Do you have an example URL that works using https? I had tested with that earlier and it wasn't working properly then. Thanks!

Yes. those links worked. Then I tried to reload nginx and now it cannot be started. =____=

Ah, the problem keeping Nginx from starting may be what's causing your sites to not work.

Are you receiving an error when trying to start Nginx? Or are any errors showing in the logs?

Hopefully this means we're close to figuring out the issue :-)

I could not start because the port is already used:

2015/08/21 10:39:28 [emerg] 3641#0: bind() to 10.0.0.5:443 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: bind() to [::]:80 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: bind() to 10.0.0.5:443 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: bind() to [::]:80 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: bind() to 10.0.0.5:443 failed (98: Address already in use)
2015/08/21 10:39:28 [emerg] 3641#0: still could not bind()

I tried to restart the server some times and now it started. You can open the site here: https://jplay.tv/ However http doesn't work.

Ah! Then it looks like Nginx is currently started, so it wouldn't be possible to launch it again.

I don't know the exact filename in your particular case, but do you know where the Nginx jplay.tv.conf file is located?

If so, could you include it's contents here?

I think other process took that port. Then I have to restart server some times so that nginx can take it back. Here is the content, I used Joomla for this site:

server {
    server_name jplay.tv www.jplay.tv;
    listen 10.0.0.5;
    server_name_in_redirect off;
 
    root /home/jplay/public_html;
    index index.php index.html index.htm default.html default.htm;
    access_log /var/log/virtualmin/jplay.tv_access_log;
    error_log /var/log/virtualmin/jplay.tv_error_log;
    fastcgi_param GATEWAY_INTERFACE CGI/1.1;
    fastcgi_param SERVER_SOFTWARE nginx;
    fastcgi_param QUERY_STRING $query_string;
    fastcgi_param REQUEST_METHOD $request_method;
    fastcgi_param CONTENT_TYPE $content_type;
    fastcgi_param CONTENT_LENGTH $content_length;
    fastcgi_param SCRIPT_FILENAME /home/jplay/public_html$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_param REQUEST_URI $request_uri;
    fastcgi_param DOCUMENT_URI $document_uri;
    fastcgi_param DOCUMENT_ROOT /home/jplay/public_html;
    fastcgi_param SERVER_PROTOCOL $server_protocol;
    fastcgi_param REMOTE_ADDR $remote_addr;
    fastcgi_param REMOTE_PORT $remote_port;
    fastcgi_param SERVER_ADDR $server_addr;
    fastcgi_param SERVER_PORT $server_port;
    fastcgi_param SERVER_NAME $server_name;
    fastcgi_param HTTPS $https;
 
    location / {
    expires 1d;
 
    # Enable joomla SEF URL's inside Nginx
    try_files $uri $uri/ /index.php?$args;
    }
 
    # deny running scripts inside writable directories
    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
                return 403;
                error_page 403 /403_error.html;
    }
 
    location ~ \.php$ {
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi.conf;
    }
 
    # caching of files 
    location ~* \.(ico|pdf|flv)$ {
                expires 1y;
    }
 
    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
    }
 
    listen 10.0.0.5:443 default ssl;
    ssl_certificate /home/jplay/ssl.cert;
    ssl_certificate_key /home/jplay/ssl.key;
    ssl on;
}
 
<code>

Okay, the very last line in your Nginx config is this one:

ssl on;

Try commenting out that line.

Then, restart Nginx.