From 41ec5fa9a896912cc873ce886863b938fd408547 Mon Sep 17 00:00:00 2001 From: Penny Leach Date: Tue, 15 Apr 2008 14:53:48 +1200 Subject: [PATCH] general web profile with bind mount trick from ~/src --- profile/web/data/vhost | 11 +++++++++++ profile/web/packages | 4 ++++ profile/web/post-vserver | 5 +++++ profile/web/pre-host | 22 ++++++++++++++++++++++ profile/web/profile.conf | 1 + profile/web/templates | 1 + 6 files changed, 44 insertions(+) create mode 100644 profile/web/data/vhost create mode 100644 profile/web/packages create mode 100644 profile/web/post-vserver create mode 100644 profile/web/pre-host create mode 100644 profile/web/profile.conf create mode 100644 profile/web/templates diff --git a/profile/web/data/vhost b/profile/web/data/vhost new file mode 100644 index 0000000..52ce512 --- /dev/null +++ b/profile/web/data/vhost @@ -0,0 +1,11 @@ + + ServerName __VSNAME__.__HOST__.wgtn.cat-it.co.nz + ServerAlias *.__VSNAME__.__HOST__.wgtn.cat-it.co.nz + + VirtualDocumentRoot /var/www/web/%1 + + ErrorLog /var/log/apache2/virtual.web.error.log + CustomLog /var/log/apache2/virtual.web.access.log combined + + + diff --git a/profile/web/packages b/profile/web/packages new file mode 100644 index 0000000..76c746f --- /dev/null +++ b/profile/web/packages @@ -0,0 +1,4 @@ +php5 +php5-pgsql +php5-json +php5-gd diff --git a/profile/web/post-vserver b/profile/web/post-vserver new file mode 100644 index 0000000..52c5600 --- /dev/null +++ b/profile/web/post-vserver @@ -0,0 +1,5 @@ +rm /etc/apache2/sites-enabled/100-htdocs +ln -s /etc/apache2/sites-available/vhost /etc/apache2/sites-enabled/100-vhost +a2enmod vhost_alias +mkdir /var/lib/web +chown www-data /var/lib/web diff --git a/profile/web/pre-host b/profile/web/pre-host new file mode 100644 index 0000000..02f9ac4 --- /dev/null +++ b/profile/web/pre-host @@ -0,0 +1,22 @@ +mkdir /etc/vservers/${VSNAME}/scripts -p +mkdir /vserver/${VSNAME}/data -p + +echo '/home' > /etc/vservers/${VSNAME}/namespace-cleanup-skip + +if [ -d /home/${PROFILEOPTION_username}/src/${VSNAME}/ ]; then + cat >/etc/vservers/${VSNAME}/scripts/pre-start << EOF + #!/bin/bash + mkdir -p /vserver/${VSNAME}/var/www/${VSNAME}/ + mount --bind /home/${PROFILEOPTION_username}/src/${VSNAME}/ /vserver/${VSNAME}/var/www/${VSNAME}/ + +EOF + chmod 755 /etc/vservers/${VSNAME}/scripts/pre-start + + cat >/etc/vservers/${VSNAME}/scripts/post-stop << EOF + #!/bin/bash + + umount /vserver/${VSNAME}/var/www/${VSNAME} +EOF + chmod 755 /etc/vservers/${VSNAME}/scripts/post-stop + +fi diff --git a/profile/web/profile.conf b/profile/web/profile.conf new file mode 100644 index 0000000..90fe524 --- /dev/null +++ b/profile/web/profile.conf @@ -0,0 +1 @@ +parent = php5 diff --git a/profile/web/templates b/profile/web/templates new file mode 100644 index 0000000..0b48e4c --- /dev/null +++ b/profile/web/templates @@ -0,0 +1 @@ +vhost /etc/apache2/sites-available/ -- 2.39.5