1. The setup
  2. Create vserver
  3. Install nullmailer in vserver
  4. Install apache in vserver
  5. Configure mysql on the host
    1. allow root to access from other hosts
    2. create hostname mysql
    3. bind mysql to mysql
    4. phpmyadmin
  6. Changes to syscp configuration
  7. Force update
  8. Install proftpd in the vserver

Issues putting apache in a vserver with syscp:

The setup

so far, everything is run in the real server, except for apache and ssh. these will run in a vserver named 'apache'.

/var/users/webs, /var/users/logs, and /var/users/configs exist in both the host and the vserver, and are mounted to the same place. this is because the apache running in the vserver will be configured by the cron script running on the host. so, the directories need to have the same path in both.

Create vserver

... detailed elsewhere ...

on the host, add to end of /etc/vservers/apache/fstab:
/vservers/admin/var/users/webs /var/users/webs  auto    rbind   0       0
/vservers/admin/var/users/logs /var/users/logs  auto    rbind   0       0
/vservers/admin/var/users/configs /var/users/configs    auto    rbind   0       0

Install nullmailer in vserver

host# vserver apache enter
apache# apt-get install nullmailer

Set remote to be mail.revolt.org (this will be /etc/nullmailer/remotes), and set the admin address to be "root@riseup.net" (this is /etc/nullmailer/adminaddr)

Make sure that /etc/hostname is "apache" and that /etc/mailname is "apache.revolt.org" if you make any changes to these, you need to restart nullmailer.

Install apache in vserver

host# vserver apache enter
apache# apt-get install apache libapache-php4 php4-gd

apache:/etc/apache/conf.d/syscp
Listen 69.90.134.160:80
<Directory /var/users/webs/>
    AllowOverride All
    Options FollowSymLinks
</Directory>

Configure mysql on the host

We are running mysql on the host.

By default, mysql binds to localhost, and syscp restricts all database users to localhost. This will not work from within a vserver, because the vserver will not be local to the mysql server. Instead, we are going to bind to hostname mysql, with IP 127.0.0.2. This will allow all the vservers to access mysql without any additional networking configuration. We also need to change the mysql users to allow connection from the vserver's host.

allow root to access from other hosts

Do this first, so that you don't lock yourself out of mysql. i am not sure the best way to do this. i did it by creating a root@%. what is the mysql for that?

create hostname mysql

add this to /etc/hosts:

127.0.0.3 mysql

bind mysql to mysql

/etc/mysql/my.conf:
bind-address = mysql

phpmyadmin

/var/www/phpmyadmin/config.inc.php:
$cfg['Servers'][$i]['host'] = 'mysql'; // MySQL hostname or IP address

Changes to syscp configuration

Changes to syscp settings so that it will work with apache in the vserver:

  • IP-Address: ip address of the vserver, not the main server.
  • Apache configuration directory: /var/users/configs/. this directory will be mounted in the host and the vserver.
  • Apache reload command: vserver apache exec /etc/init.d/apache reload
/var/www/syscp/lib/userdata.inc.php:
$sql['host']='mysql';

The setting mysql_access_host controls what value to use for each user's database access. There is no interface to editing this value.

USE syscp;
UPDATE panel_settings SET value='\'%\'' WHERE varname='mysql_access_host';

The extra single quotes are a hack to get the syscp quiries to work correctly. In the future, syscp should be modified to quote the value itself, so that % will work.

NOTE: once you will have made this change, it will break all the attempts to use syscp to edit these users. you should manually change the host for pre-existing users to %.

Force update

it can be very useful to be able to manually force an update instead of waiting around for syscp to create new configs and reload apache. use this script:

/usr/local/sbin/forceupdate:
#!/bin/bash

echo -n "updating configuration files"
/usr/bin/php4 -q -c /etc/php4/syscpcron /var/www/syscp/scripts/cronscript.php
if [ $? = 0 ]; then
   echo "...done"
else
   echo "...failed!"
fi

echo -n "apache: "
vserver apache exec /etc/init.d/apache restart
if [ $? = 0 ]; then
   echo "...done"
else
   echo "...failed!"
fi

Install proftpd in the vserver

host# vserver apache enter
apache# apt-get install proftpd-mysql

Configure /etc/proftpd.conf using the configuration that is in the syscp administration--->Server--->Configuration--->ProFTPd(ftp) and restart proftpd when finished.