Hi,
I am trying to setup virtual servers where Apache runs under the virtual server owner's userid and a local php.ini file is loaded but not succeeding:
I am using the GPL versions of Webmin (1.550) and Virtualmin (3.87) and Ubuntu 10.04.3 as the OS. When I installed Ubuntu I selected the LAMP package and then installed Webmin and Virtualmin.
Problem is that the php.ini file that is being loaded is "/etc/php5/apache2/php.ini" instead of "/home/virtual2/etc/php5/php.ini" and Apache is using "www-data(33)/33" as userid instead of "virtual2" and is adding "www-data" to the virtual1 and virtual2 local groups.
Besides the standard installation here is what I did:
sudo apt-get install apache2-suexec-custom
cd /etc/apache2/suexec
sudo vi www-data
replace the line "/var/www" with "/home" (without "" ).
sudo /etc/init.d/apache2 restart
Enabled the following additional mods for Apache through Webmin Apache configuration:
○ 'actions'
○ 'suexec'
○ 'rewrite'
sudo aptitude install libapache2-mod-fcgid php5-cgi
Then I completed the Virtualmin Post-Installation Wizard and disabled BIND and MAIL as they are not installed. I created two virtual servers (Virtual1 and Virtual2):
Virtual1 - Used all defaults except I created a virtual local IP for the server. Virtual2 - Created virtual local IP for server and under VIrtual Server Website Options I specified "FCGId (run as virtual server owner)".
Here is what gets created for each of this servers: For Virtual1:
Directories:
/home/Virtual1
/home/Virtual1/cgi-bin
/home/Virtual1/homes
/home/Virtual1/logs (also error and access log files are created in this directory)
/home/Virtual1/public_html
/home/Virtual1/public_html/stats
For Virtual2:
Directories:
/home/Virtual2
/home/Virtual2/cgi-bin
/home/Virtual2/etc
/home/Virtual2/etc/php5
/home/Virtual2/fcgi-bin
/home/Virtual2/homes
/home/Virtual2/logs
/home/Virtual2/public_html
/home/Virtual2/public/stats
/home/Virtual2/tmp
Within the /home/Virtual2/fcgi-bin the following file is created automatically as well: file name: php5.fcgi Content:
#!/bin/bash
PHPRC=$PWD/../etc/php5
export PHPRC
umask 022
export PHP_FCGI_CHILDREN
SCRIPT_FILENAME=$PATH_TRANSLATED
export SCRIPT_FILENAME
exec /usr/bin/php5-cgi
Finally here is a copy of the virtual2.conf file created in /etc/apache2/sites-available directory:
<VirtualHost 192.168.1.107:80>
SuexecUserGroup "#1002" "#1002"
ServerName virtual2
ServerAlias www.virtual2
ServerAlias webmail.virtual2
ServerAlias admin.virtual2
DocumentRoot /home/virtual2/public_html
ErrorLog /var/log/virtualmin/virtual2_error_log
CustomLog /var/log/virtualmin/virtual2_access_log combined
ScriptAlias /cgi-bin/ /home/virtual2/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/virtual2/public_html>
Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/virtual2/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/virtual2/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/virtual2/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.virtual2
RewriteRule ^(.*) http://virtual2:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.virtual2
RewriteRule ^(.*) https://virtual2:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 9999
</VirtualHost>
Any help will be greatly appreciated.
Carlos
Howdy,
How did you go about installing Virtualmin -- did you by chance use the install.sh script? You're using a supported distro, so that should work great -- but the steps you're mentioning above sound like you're doing a manual installation.
If you use the install.sh script, it should have all that working well for you out of the box.
However, if that's not desirable -- the problem you're having sounds like an issue we saw where having mod_php enabled on the server causes it to take over all websites... to fix it, edit /etc/apache2/mods_enabled/php5.conf, and comment out the two lines beginning with "SetHandler".
After that, restart Apache, and see if that does the trick for you.
-Eric
Hi Eric,
First of all thank you for replying so promptly. Indeed your suggestion fixed my problem and as you suspected and I mentioned in my original posting, I did not use the install.sh script since I had installed the server as a LAMP server within Ubuntu installation.
I have one more question if I may:
I did a couple of steps outside of standard installation instructions, would these be needed if I use the install.sh on a basic Ubuntu 10.04 server install? I am referring to these steps:
sudo apt-get install apache2-suexec-custom
cd /etc/apache2/suexec
sudo vi www-data
replace the line "/var/www" with "/home" (without "" ).
sudo /etc/init.d/apache2 restart
Enabled the following additional mods for Apache through Webmin Apache configuration:
○ 'actions'
○ 'suexec'
○ 'rewrite'
sudo aptitude install libapache2-mod-fcgid php5-cgi
Thanks so much for your help!
Howdy,
Although using the "LAMP" installation on Ubuntu installs a number of LAMP related packages -- there's a number of things that won't be configured correctly by default.
Now, those are all things you can do manually -- but it'll end up being a lot more work :-)
To answer your question -- yeah, the apache-suexec-custom changes, module adjustments, and additional package installations -- most of that is handled for you by the install.sh (I'm not sure the installer would enable "rewrite", but "suexec" would be enabled by default).
Also, the installer fixes the "SetHandler" issue you corrected.
There's a document describing what all you'd want to tweak if you're performing a manual installation:
http://www.virtualmin.com/documentation/installation/manual
I'd recommend going through that and making any of the config tweaks/adjustments it mentions.
Lastly -- even though you did a LAMP install on Ubuntu, the install.sh should still work just fine. It would just mean there's a few less packages it needs to install.
-Eric