How to create multiple projects: Follow these steps if you have a running Appaserver application and you would like to add more applications because you have multiple projects. Each project will run in its own database, have its own Appaserver configuration file, and have a set of unix accounts accessing it from the command line. In this document, assume $project is the project's name. 1) Create the following shell script. Call it set_project.sh, and place it in /usr/local/bin. #!/bin/sh #set_project.sh #------------------------------------------------------- #This script set the environment variable PROJECT_HOME. #It also sets PATH to first check this project's cgi-bin #directory for the appaserver configuration file. #Remember: you must dot this file. #------------------------------------------------------- if [ $# -ne 1 ] then echo "Usage: . $0 project" 1>&2 exit 1 fi project=$1 if [ "$project" = "foo" ] then export PROJECT_HOME=/usr/foo elif if [ "$project" = "bar" ] then export PROJECT_HOME=/usr/bar fi export PATH=${PROJECT_HOME}/cgi-bin:$PATH exit 0 2) Set umask to be group centric. a. Edit /etc/profile b. umask 002 3) Add the virtual host to the DNS server. Or add the virtual host to each computer's /etc/hosts file. The virtual host is assumed to be $project.$server. Note: $project is the project's name, and $server is the output to 'uname -n'. For example, in /etc/hosts: IP1.IP2.IP3.IP4 $project.$server IP1.IP2.IP3.IP4 foo.sunset 4) Setup virtual hosts in Apache. a. Edit /etc/apache/httpd.conf. In this script, hardcode $project_home to be the same as the environment variable $PROJECT_HOME. #Turn on virtual hosting. #------------------------ NameVirtualHost IP1.IP2.IP3.IP4:80 #Setup the default virtual host. #------------------------------- ServerName $server <-- uname -n DocumentRoot /var/www <-- whatever's current ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <-- whatever's current #Setup a virtual host for each project. #-------------------------------------- ServerName $project.$server DocumentRoot $project_home/www ScriptAlias /cgi-bin/ /$project_home/cgi-bin/ #For example: DocumentRoot /usr/foo/www ScriptAlias /cgi-bin/ /usr/foo/cgi-bin/ 5) Create the unix group for this project. $ su # addgroup $project # edit /usr/local/bin/set_project.sh <-- Add $PROJECT_HOME for this $project. # . /usr/local/bin/set_project.sh $project <-- Sets the $PROJECT_HOME environment variable. # mkdir $PROJECT_HOME # cd $PROJECT_HOME # mkdir cgi-bin www # chown apache:$project . cgi-bin www # chmod u+rwx,g+rwxs,o-rwx . cgi-bin www # cp /etc/appaserver.config cgi-bin <-- set $project to be the default database. # chmod u-w,g-w,o-rw cgi-bin/appaserver.config # cp $APPASERVER_HOME/index_template.html www/index.html <-- edit index.html to taste. # exit 6) Create the database for this project. $ . /usr/local/bin/set_project.sh $project <-- Sets the $PROJECT_HOME and PATH environment variables. $ echo "create database $project;" | mysql -uroot -p 7) Create a unix account and assign it to a project. $ su # adduser foo # edit /etc/group <-- add foo to $project # edit ~foo/.bashrc . /usr/local/bin/set_project.sh $project # exit 8) Instruct each user how to access their project's database from a browser. http://$project.$server 9) Instruct each user how to access their project's database from the command line. $ echo "select * from some_table;" | sql 10) Instruct users with multiple projects how to switch between them. $ . set_project.sh $project <-- remember to dot this file.