Creating a Joomla Demo Site the right way
Ok for some reason four people emailed int he last 24 hours asking how I created my demo site to refresh every hour so this must be an interesting topic at the moment.
The first thing you really need is full root access to your server - although you can probably do this in a normal account you are going to need to be able to modify cron jobs and shell scripts.
First build your demo site locally - make it perfect and final. Once you have that dumpt the database to a sql file.
On your demo servers domain, replicate the site into your public_html folder and also a new folder called public_html.restore
We then use a cronjob that is fired every hour to run a shell script that will DELETE all the files in the public_html folder (Tip 1: Some people DONT do this, the problem then is that hackers can upload files and they will be available for years to come!) The cronjob then runs the SQL file using command line mysql, first dropping the database (Tip 2: remove the whole database, dont allow any dust) and then recreates it with the sql from the file.
Tip 3: Disable file uploads for your demo domain
Tip 4: Install mod_security with a good set or rules (ours come from gotroot.com)
Tip 5: Our line in our crontab reads:
32 * * * * sh /home/demo/refresh.sh
Tip 6: Here is an example refresh.sh
mysql -u root –password=pa$$word < /home/demo/public_html.restore/sql.sql
rm -Rf /home/demo/public_html/*
cp -Rf /home/demo/public_html.restore/* /home/demo/public_html/
find /home/demo/public_html -type f -print | xargs chmod 644
find /home/demo/public_html -type d -print | xargs chmod 755
Note the changing of the permissions in the last two lines
Note that this is just an example and the password and paths are actually not correct for our server
Tip 7: If you dont need people to use other parts of Joomla then remove the components! For example, we often remove com_user and com_config if not needed. You can also remove com_installer and then no one can install other extensions…
Hope this helps someone - let us know if you have questions as I have rushed writing this today


Tags: