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 /home/virtual2/cgi-bin>
allow from all
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
Any help will be greatly appreciated.
Carlos