Backup fails when using other port than 80

10 posts / 0 new
Last post
#1 Mon, 05/18/2009 - 10:14
vitobotta

Backup fails when using other port than 80

Hi,

I am using Virtualmin Pro, and so far I like it a lot. However I am now having a problem with backups. I have installed nginx as front end to apache, therefore apache listens to the port 8080 while nginx to the port 80. With this simple change, when I run a manual or scheduled backup, the backup fails and Virtualmin says:

Creating backup for virtual server vitobotta.com .. Copying virtual server configuration .. .. done Backing up Cron jobs .. .. none defined. Copying Apache virtual host configuration .. .. no Apache virtual host found! Backing up Virtualmin settings (Module configuration, Server templates, Reseller accounts, New mailbox email messages, Custom fields, links and shells, Third-party script installers, Third-party content styles, Scheduled Virtualmin backups) .. .. done Backup failed! See the progress output above for the reason why.

Of course the virtual host files are there, and the websites are working (well, nothing is available live yet because I am still working on a blog and some other stuff). If I only change the port from 8080 to 80 in the directives for the virtual hosts, then the backup proceeds as usual.

What to do? Thanks in advance

Mon, 05/18/2009 - 10:42
vitobotta

I've solved by changing the port from "Change IP Address", in the settings of the virtual servers.
The backup is now working.
Where does Virtualmin stores this data? I thought it was only in the usual vhost files :)

Mon, 05/18/2009 - 11:39 (Reply to #2)
Joe
Joe's picture

<div class='quote'>Where does Virtualmin stores this data? I thought it was only in the usual vhost files :) </div>

Virtualmin does keep some meta-data (unlike Webmin, which keeps very little) in /etc/webmin/virtual-server. The reason for this is that vhosts files don't know anything about how everything interrelates. The vhosts file can't tell Mongrel what ports to listen on or which vhosts belong to which user, the postfix main.cf can't tell mailman which mailing lists belong with which virtual server, the MySQL configuration can't tell an installed application which database to use, etc. Virtualmin does all of those things...so it keeps up with those associations in its own configuration files.

In general, you can make changes to the vhosts file or anything else on the underlying system and Virtualmin will respect them (certainly moreso than any other product or project in this space, since pretty much no other product actually understands the configuration files and instead just spits out predefined template-based crud). But those associations (like which VirtualHost sections belong with what virtual server) have to be kept up with outside of the system configuration files. The vhost file knows nothing about your backup schedule and who those backups should belong to.

--

Check out the forum guidelines!

Mon, 06/14/2010 - 16:25
mikerobinson

I'm having a similar issue. I have a domain mydomain.com and the sub-server secure.mydomain.com. Since we are transmitting sensitive information, I commented out the VirtualHost in my httpd.conf file for the insecure site running on port 80 since I do not want it to be accessible, however I left the SSL enabled VirtualHost there. When I try to do a backup, I get an error saying "Copying Apache virtual host configuration ..
.. no Apache virtual host found!"

Is there any way around this?

Mon, 06/14/2010 - 17:40
andreychek

Yup, rather than commenting out the VirtualHost section, you can use a .htaccess file to prevent access to the non-SSL site.

To do that, just create a file named .htaccess in the site's public_html folder, and put something like this in it:

RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.example.com [R]

That says that if the site ever receives a request not on port 443 (the SSL port), to redirect to SSL.

-Eric

Thu, 06/17/2010 - 16:35
mikerobinson

Hi Eric,

The code you have there just gives me a server error. I don't think you can mix HTML in the .htaccess file. At least I've never seen it like that. I have instead:

RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://secure.mydomain.com/$1 [L,R=301]

This seems to work fine if I go to http://secure.mydomain.com, however if I go to http://secure.mydomain.com/foo/ it doesn't forward me.

Thu, 06/17/2010 - 20:28
andreychek

Nuts, the forum mangled what I originally attempted to paste in there. I'm glad you figured that part out :-)

Now, as far as it not working for /foo/ -- what is it doing, or not doing? Does it redirect at all?

-Eric

Thu, 06/17/2010 - 20:28
andreychek

Nuts, the forum mangled what I originally attempted to paste in there. I'm glad you figured that part out :-)

Now, as far as it not working for /foo/ -- what is it doing, or not doing? Does it redirect at all?

-Eric

Thu, 06/17/2010 - 23:05
mikerobinson

It doesn't redirect at all. It accesses the http:// page as normal.

Mon, 08/09/2010 - 16:14
mikerobinson

OK I know it's been a while, but I got it figured out in case anyone else has the same problem in the future. It's better to do the forwarding right in the VirtualHost of your httpd.conf file. I just added the following in the port 80 server that I want to be forwarded to https:

Redirect / https://www.mydomain.com/

Topic locked