Apache & FTP directory protection

Hello,

some of my FTP users created by Virtualmin remove their public_html and log directories, and then when apache restart comes, it does not fire up, because it misses "logs" directory.

Is there any official way how to workaround this? If they delete their whole folder, so they not cause apache failures...

Thank you

Status: 
Active

Comments

Howdy -- on a new installation, the default for Apache logs would place them in /var/log/virtualmin, which would prevent against the problem you're seeing there.

However, older installations may be setup to use $HOME/logs directly, which can indeed be deleted.

What you could do is use the writelogs program to handle your logging, rather than have Apache log to $HOME/logs directly.

There's two steps to do that --

First, go into System Settings -> Server Templates -> Default -> Apache Website, and enable the "Write logs via program" option, which says that it "Handles missing log directory".

That will resolve it for new Virtual Servers. For existing ones, you can resolve that with the next step --

Second, log into your server over SSH as root, and run this command: virtualmin enable-writelogs --all-domains

After that, Virtualmin will use the special writelogs program for logging.

A missing public_html folder will generate a warning, but not an error -- so you wouldn't actually need to do anything with the public_html folders.

eric, sorry hijack, but is the folowing a pro feature? Couldn't find it in the GPL version.

First, go into System Settings -> Server Templates -> Default -> Apache Website, and enable the "Write logs via program" option, which says that it "Handles missing log directory".

The writelogs option is available in both the Pro and GPL versions of Virtualmin -- however, it's only necessary if the logs are stored in the users home directory.

I believe what's happening is that Virtualmin isn't showing the option for you if the logs are stored in /var/log/virtualmin.

My recommendation though is to keep the logs in /var/log/virtualmin and not to use writelogs, if possible.