A small Web Hosting with OpenPanel + Ubuntu Server 10.04 LTS + some tricks

Hi,

I’m trying Openpanel, a great new opensource tool that helps developers make a complex server tasks with some mouse clicks.

http://www.openpanel.com/

You can create domains, mail accounts, DNS and other stuff in a “Panel” way. You can create user accounts and allow them to create their own domains, emails and vhosts.

I’m trying it on linode

www.linode.com

With Ubuntu Server 10.04 LTS (You can deploy this image from linode dashboard. You have a virtual machine running after 5 min max)

After a successful OpenPanel install, I need to make my users vhosts run as Apache process of their own user. This way, their php and other apps could write under their directories and make some personal stuff, as also it gets better to my administration tasks.

Unfortunately, this feature is not yet implemented (but it’s on the roadmap), so I need to create the followin “hack”:

  • Install a new MPM apache module:
    sudo apt-get install apache2-mpm-itk
  • Write a script that’s create the directives which makes every vhost runs under it’s owner account and put ir under crontab to run every 10 minutes
    sudo pico /opt/apacheexec.sh
    Put the following content on it:
#!/bin/bash
for sites in /home/*/sites/*
do
    user=`echo "${sites}"|cut -d'/' -f 3`
    site=`echo "${sites}"|cut -d'/' -f 5`
    arquivo=`echo "/etc/apache2/openpanel.d/${site}.inc/mpmitkUser"`
    if [ -f $arquivo ]; then
        true
    else
        echo "<IfModule mpm_itk_module>" > $arquivo
        echo "AssignUserId ${user} ${user}" >> $arquivo
        echo "</IfModule>" >> $arquivo
        exec `/usr/sbin/apache2ctl graceful`
    fi
done
  • Then, make it executable
    chmod a+x /opt/apacheexec.sh
  • Finally, put it to run on crontab
    sudo crontab -e -u root
  • Write it:
    */10 * * * * /opt/apacheexec.sh

And we are done!

2 thoughts on “A small Web Hosting with OpenPanel + Ubuntu Server 10.04 LTS + some tricks

  1. Reinaldo Silva

    Ronaldo, bom dia.

    Temos um OTRS instalado que usamos para chamados e ITSM changes, estamos precisando de alguas personalizacoes no sistema, voce faz consultoria ? Estamos em Alphaville-SP

    Att

    Reinaldo

    Reply
    1. richieri Post author

      Reinaldo! Desculpe pela demora em te responder!

      O meu de notificação do teu comentário no meu blog ficou no spam. Só vi hoje!

      Se precisar ainda, faço modificações sim! Hoje inclusive estou em um cliente em Porto Alegre fazendo isso.

      Mas moro aí do ladinho de Alphaville, em Sorocaba.

      Se ainda precisarem de ajuda, podem entrar em contato comigo, ainda hoje. Meus telefones estão abaixo.

      Abraço!

      Reply

Leave a Reply