File Permissions on New Virtual Host

I am trying to evaluate a few Virtual Hosting Control Panel tools beginning with the GPL Virtualmin module for Webmin. All seems to be setup correctly, I create my first virtual host with its own IP. I can ssh into the host no problem, files all seem to be owned by the account (mynewdomain.mynewdomain in this case). So I thought I would go through a test install of Joomla as if I were the user.

Uploaded the Joomla files and went through the installer, however the installer shows that none of the files/folders are writeable and I dont want to go in an change this manually since it needs to work out-of-the-box for the clients who will be setting up their own sites. I assume this is due to apache running under the apache account? Or is there something else I need to do so that a new site can write to is own document root?

Thanks for any help anyone can provide

Hi Johnny,

Did you log into your own interface https://mynewdomain:10000 (or whatever port you installed)when you did this?

And frankly, VMPro has it’s own script installer to install joomla and a host of others.

Thanks for the quick response. I tried to buy the 10 host license for VMPro but my card is full. After creating the new site/host I just ssh’d into the host and uploaded all the Joomla files. They are of course owned by the user (mynewdomain.mynewdomain) so how can I set things up so that the apache process can also write to any given hosts files/site?

I can of course login to the webmin panel at the url you indicated. But I dont see any way to install something like Joomla so I just sent them through SSH. Is there a different or preferred way to do this? I need to make this as idiot-proof as possible for the client as they are not very familiar/comfortable with *nix. I basically would like things to work similiar to any given commercial hosting package like cpanel. I do plan to get the pro version as soon as I make room on my card but is there a trial version available that I could test out?

Thanks again for your quick response

Hey Johnny,

Yeah, only Professional has the Install Scripts feature. There currently isn’t a trial version. We plan to offer one once the Early Adopter period is over and our new license manager is online.

But to solve your problem, you’ll want to setup Virtualmin to configure PHP scripts to run under suexec (they run under mod_php by default, since suexec requires quite a bit of extra stuff that isn’t generally provided by most operating systems out of the box).

Specifically:

Rebuild Apache to have suexec docroot in /home.

Install mod_fcgid (depending on your OS, you may be able to get this from the standard package repository, or you may need to build it from source or download a third-party package).

Install the standalone php-cgi (sometimes in a package called php-cgi, or installed in the default php package–but it’s always available from your OS standard packages).

Then edit the Server Template(s) that you use and find the "Apache Website" section. Then dig down into the "Default PHP exection mode", and choose "FCGId (run as virtual server owner)".

Again, this isn’t the default, because it requires some additional packages, and a custom build of your Apache package.

We will be providing the same install script and repositories that we offer for Professional as soon as I have time to build it and the scripts to maintain it…I just haven’t had the time yet.

It’s not that hard to setup Virtualmin GPL to use php+suexec+mod_fastcgi/mod_fcgid. And you dont need to recompile apache, u can just instruct virtualmin to set the users’ homes in /var/www (most distros have with a suexec enabled for that path).

I just logged into the VirtualMin Pro demo and can see an option to set apache’s php scrip execution mode to either mod_php, CGI or FCGId. Is this functionality built in/installed with the pro version by default, or do I need to do the additional configurations you mentioned below? Also, is there a way this can be done without recompiling apache? Another user posted a response indicating this was possible without the apache re-compile.

Thanks

Hey Johnny,

mod_fgid and suexec is installed and setup by default on our supported Operating Systems. It is now our default execution type for Virtualmin Professional (and recommended for all Virtualmin installations, GPL included). The installer will soon exist for GPL, and it’ll also handle setting this stuff up. The installer needs quite a bit of cleanup and bugfixing, however, before we can unleash it on the thousands of Virtualmin GPL users–our support load would go through the roof. Already, I spend a lot of time dealing with stupid installer bugs (I can say as many bad things about the installer as I want, because I wrote it…). :wink:

Could you point me to where someone suggested this would work without a recompile of Apache? That’s incorrect. SuExec needs to be recompiled with a suexec docroot of /home. There’s no avoiding this unless you want to do other, far more uncomfortable and time-consuming things.

Re-compiling Apache is not hard! Don’t waste your time doing stupid stuff trying to avoid an Apache rebuild. Just rebuild Apache and get on with things. :wink:

Here’s how:

Grab the latest SRPM for your OS and version from your favorite updates mirror (if using a Red Hat based system) or run "apt-get source apache2" if using Debian/Ubuntu.

SRPM rebuild:

rpm -ivh httpd-blahblah.src.rpm
vi /usr/src/redhat/SPECS/httpd.spec

Find the configure section and change the suexec-docroot line to look like:

–with-suexec-docroot=/home

Save it.

rpmbuild -ba httpd.spec

Install the resulting packages.

Now, edit the yum.conf or up2date configuration and set it to exclude httpd* (so you don’t replace it with subsequent OS updates, and break your suexec).

For Debian/Ubuntu, cd into the apache2/debian directory. Edit "rules" and change the suexec-docroot similar to the above.

Save it.

Build the packages with "debuild" in the apache2 directory.

Install them with dpkg.

Bonus points if you take the time to bump the revision, and add a changelog entry with "dch -i".

As above, edit the apt configuration to skip apache2, so it doesn’t replace your Apache package with one that has suexec set to somewhere else.

I’ve posted other RPM build instructions here in the forums in the past…here’s the thread:

http://www.virtualmin.com/forums/message-view?message_id=29366

Saw a previous post with this…

"Install the standalone php-cgi (sometimes in a package called php-cgi, or installed in the default php package–but it’s always available from your OS standard packages).

Then edit the Server Template(s) that you use and find the "Apache Website" section. Then dig down into the "Default PHP exection mode", and choose "FCGId (run as virtual server owner)"."

So I confirmed that php_cli is installed which includes the php_cgi.

But I am unable to locate a setting for "Default PHP Execution" in the "Apache Website" section of the default template?

Hey all-

I’m going nuts trying to find this “Script Execution Mode” on Virtualmin GPL (3.44). Like JohnnyStork, I can’t seem to find it on the server template. Can someone point me to where this is / is supposed to be? I’m running FreeBSD 6.2 if it makes a difference…

Thanks!

John

Well, reading the source I just found it in a block that starts “if ($virtualmin_pro)”. Hmm…methinks it’s time to upgrade…

Hi There,

Well… I’ve virtualmin pro and everything was set according to the previous posts, but I am still having the same problem that you face now…

My users doesn’t have the permission to change/write any file using php (joomla).

Someone has another solution for that ?

Thank you,

r.

Well I think I am almost there, but still no luck getting a default joomla installer to be able to write to the web root owned by a user.

I installed the httpd src rpm, updated the spec file and rebuilt. I had to use rpm -Uvh --nodeps --force to get the rpms to install and they got installed as "httpd 2.2.3-6%{dist}".

Is there any way to fix that dist name to be correct? I tried this on a test machine first.

I also installed the mod_fgid module and it seemed to load fine…no errors in /var/log/httpd/error_log

I created a virtual host for a domain, testdomain.

All files are of course owned by testdomain, so the Joomla installer still cant wrote to them.

have I missed a step?

Thanks for your help at this stage, it is really appreciated.