Error creating new virtual server from backup

I am moving to a new hosting server and have found if I create a new virtual server from the menu its all good but if I try and restore a backup in virtualmin I get the error "strict refs" in use at virtualmin-nginx-lib.pl line 251. and it doesnt create the virtual host in NGINX. The file restored in \etc\nginx\sites-available has the incorrect permissions but it is also empty.

Status: 
Closed (fixed)

Comments

Can you post the full error message that you're getting?

As part of restoring the virtual server I get the following error in webmin

Restoring Nginx webserver configuration .. .. Nginx virtualhost was not found after restore!?

I assume it may be this command not working

cp -p \/tmp\/.webmin\/301157_2359_2_restore.cgi\/cleverfinance.com.au_virtualmin-nginx_complete \/etc\/nginx\/sites-available\/cleverfinance.com.au

As once the restore is complete the file under etc\nginx\sites-available has the wrong owners and there is nothing in the file, I have to recreate the file myself.

In your primate Nginx config file, is there an Include statement that references /etc/nginx/sites-available , and if so what does it say exactly? The cause may be that it only matches files with a .conf extension.

Also, I assume that the file /etc/nginx/sites-available/cleverfinance.com.au was created correctly?

NGINX CONFIG FILE

user www-data; worker_processes 2; pid /run/nginx.pid;

events { worker_connections 768; # multi_accept on; }

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
    client_max_body_size 10M;
server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable msie6;

     gzip_static on;
 gzip_vary on;
 gzip_proxied any;
 gzip_comp_level 6;
 gzip_buffers 16 8k;
 gzip_http_version 1.1;
 gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;

##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##

#include /etc/nginx/naxsi_core.rules;

##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server_names_hash_bucket_size 128;
ssi off;
ssi_silent_errors off;

}

mail { # See sample authentication script at: # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # auth_http localhost/auth.php; # pop3_capabilities "TOP" "USER"; # imap_capabilities "IMAP4rev1" "UIDPLUS"; server { listen localhost:110; protocol pop3; proxy on; } server { listen localhost:143; protocol imap; proxy on; } }

On the second part, the file is not created properly as part of the restore. After restore it is blank and has the incorrect owners. Below is the result from webmin restore

Starting restore of 1 domains from local file /nas/cleverfinance.com.au.tar.gz ..

Extracting backup archive file .. .. done

Restoring backup for virtual server cleverfinance.com.au ..

Restoring virtual server password, quota and other details .. .. done Updating administration password and quotas .. .. done

Restoring Cron jobs .. .. done

Extracting TAR file of home directory .. .. done

Setting ownership of home directory .. .. done

Re-creating records in DNS domain .. .. done

Restoring Webalizer configuration files and Cron job .. .. done

Restoring allowed MySQL hosts .. .. done

Deleting old MySQL databases .. .. done

Re-loading MySQL database cleverfinance ..

Creating MySQL database cleverfinance .. .. done

.. done Restoring Nginx webserver configuration .. .. Nginx virtualhost was not found after restore!?

Re-starting DNS server .. .. done .. failed! See the progress output above for the reason why.

That primary config file looks fine - the real issue seems to be that the backup is missing the config for the original domain. Would it be possible for us to get a copy of the backup you are trying to restore? You can email it to me at jcameron@virtualmin.com

The smallest of the backups I have used is 105MB, don't think your email would cope with that, do you have another way to get it too you?

I could download it via FTP, SCP or HTTP?

Thanks, I have downloaded the file.

By the way, if you create a new domain with an Nginx website on the same system, does it work OK?

HI Jamie,

Yes a new domain created on the existing system works fine.

So I restored your example backup file just fine on a test Nginx system. However, the cause may be that the config files for new domains are being placed in an unexpected location - can you post your /etc/webmin/virtualmin-nginx/config file, so I can see how that is setup?

nginx_cmd=/usr/sbin/nginx add_to=/etc/nginx/sites-available stop_cmd=service nginx stop php_socket=1 add_link=/etc/nginx/sites-enabled nginx_config=/etc/nginx/nginx.conf child_procs=4 start_cmd=service nginx start apply_cmd=service nginx restart

Ok, I found the bug that causes this. The work-around till the next release of the Nginx plugin is to remove the add_to= and add_link= lines , which will cause the configs for restored domains to be added to the main Nginx config file.

Thanks, just happy to find the problem and look forward to the release.

Automatically closed -- issue fixed for 2 weeks with no activity.