Forum archive
Add new application to an appliance
Hi,
I installed the moodle appliance, and now I want to serve my own web application from the same installation. Now, when I examine it, I see that you arrange it so that different applications will be served from different ports. E.g. port 80 serves moodle, port 12123 or st. serves phpmyadmin, and port 12121 or st. serves the webmin. So the port decides the application to serve.
What I want is to switch to a url based (same port for all) configuration: http:/somebaseurl/moodle should serve moodle, http:/somebaseurl/phpmyadmin should serve phpmyadmin, http:/somebaseurl/myapp should serve my custom app. How can I do this?
I know this question is mostly about Apache configuration, but I think other users can benefit from the answer. I don't know how to configure Apache, I usually edit the conf file that comes with the installation.
Thanks In advance.
Ps: In your appliance you use /usr/share/mooodle, /usr/share/phpmyadmin ... for local files, and under the /etc/apache2/available-sites, you make these directories the documentroot for the corresponding application. The way I usually do this is to just put moodle, phpmyadmin, and myapp folders under the same documentroot, and there you go... Is this not secure?
But that can easily be changed so you can use Apache for other content (easy being a relative word!).
Now assuming you want Moodle at http://<appliance-ip>/moodle and a new web app to http://<appliance-ip>/new-webapp look below. If you do it this way, you can also put a landing page at http://<appliance-ip>/index.htm.
As you probably know, there are often many different ways to do the same or similar thing, this is not a definitive how-to, its just how I'd do it. My rationale is that doing it this way, allows for you to add additional LAMP content easily (just add it to /var/www/). Now I warn you that I am a bit of a newb when it come to Apache config, so I'm hoping this works :)
Firstly backup the moodle sites-available file (in case it doesn't work) and use it to create a new template file:
Edit your new file:
and make it look like this (changes in bold):
NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> UseCanonicalName Off ServerAdmin webmaster@localhost DocumentRoot /var/www/ </VirtualHost> <VirtualHost *:443> SSLEngine on SSLCertificateFile /etc/ssl/certs/cert.pem ServerAdmin webmaster@localhost DocumentRoot /var/www/ </VirtualHost> <Directory /var/www/> Options +FollowSymLinks AllowOverride All order allow,deny allow from all </Directory><Ctrl><x> to exit and save.
Now edit /etc/apache/sites-available/moodle
Delete everything in there and replace it with this:
Alias /moodle /usr/share/moodle/ <Directory /usr/share/moodle/> Options +FollowSymLinks AllowOverride All order allow,deny allow from all </Directory><Ctrl><x> to exit and save again.
Now enable your new-default site and restart Apache. Fingers crossed it all works!
Now any new content can go straight to /var/www/ as this is your default document root (like a default LAMP install) eg, your new web app can go at /var/www/new-webapp and will be availabel at http://<appliance-ip>/new-webapp. Moodle obviously still comes from its default doc root.
Let me know how you go. Also anyone else with more Apache experience who would like to crtique my suggestions please feel free to chip in!
[edit] To make this work also requires editing the Moodle config (see comment & link below).