| Running web apps from your home folder |
|
|
|
| Thursday, 15 October 2009 13:37 |
|
I originally needed to move Apache's document root to make it easier to work on a backup copy of my blog from my home folder. Now that I've moved to Joomla, and I've just installed the latest Ubuntu 9.10 beta, I've decided to revisit my installation procedure and try a different method that doesn't involve moving the /var/www folder. First of all, install Apache, PHP, MySQL and phpMyadmin from the repos. This version of phpMyAdmin in the Ubuntu 9.10 repo is up to date and it automatically handles setting up the finicky stuff like the PMA extensions, so we'll take the easy way out and let Synaptic do it for us. You'll be prompted to pick a MySQL password while installing, asked for the same password again when phpMyAdmin installs, and finally asked for an extra password for the phpMyAdmin to use internally. The extra lines will enable the Apache modules that are needed for Joomla. sudo apt-get install mysql-client mysql-server php5-mysql php5-mcrypt php5 libapache2-mod-php5 apache2 phpmyadmin You can now check that your apache server and phpMyAdmin is working by browsing to http://127.0.0.1/phpmyadmin, which should show you the phpMyAdmin login page. We're going to use Apache's Alias command to create a folder in your home that Apache will point to when you browse to http//127.0.0.1/joomla, so create the folder and a temporary file that we can use for testing later. mkdir ~/www/joomla Next, create the Apache configuration file in a folder called scripts in your home. I've provided the following script to generate the file as you'll need to specify the full path to the /www/joomla/ folder. Using the home folder shortcut "~/" will cause Apache to display a 404 when you try to browse to your Joomla folder. The file is very simple, so if you are interested, just open it and have a look once it's been created. mkdir ~/scripts To get Apache to read the configuration file when it starts, create a symlink in the Apache conf.d folder. We could of course create the configuration file in the /etc/apache2/conf.d folder in the first place, but the next time you upgrade your Ubuntu install, you'll lose it. This way, by leaving the joomla.conf file in your home folder, the next time you upgrade your operating system, all you'll have to do is create a symlink. sudo ln -s ~/scripts/joomla.conf /etc/apache2/conf.d/joomla.conf Lastly, the user that runs the Apache server has no access to your home folder, so to make life easy, simply use your user name instead by replacing the two references to "www-data" in the envvars file with your login user name. This is of course recommended only for development systems! sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak Finally, restart Apache. sudo /etc/init.d/apache2 restart Browsing to http://127.0.0.1/joomla should show you the "Hello World" page we created earlier, and if that works, then you can install Joomla into the www/joomla folder in your home. As an added bonus, you can use this method to execute web applications no matter where they are located on your PC, simply by creating new conf for each root folder you want Apache to be able to see, then placing a symlink to the conf in the /etc/apache2/conf.d folder and restarting Apache. blog comments powered by Disqus |


