Description
This tutorial is will show how to set up an apache server for web development which allows for sites to be written in any language and framework. This is tailored for Mac OS X and is meant for developers who write websites in multiple languages and frameworks. This tutorial starts by setting up apache, languages and framework followed by the site setup. The site setup is a website that allows browsing of web directories for viewing.
Minimum Requirements
- php 5.0
- apache 2.0
- gems 1.3
Setup
OSX and Apache Configuration
First go to System Preferences -> Sharing and click on Web Sharing which allows for apache to be turned on. The “Computer Name” will be the name entered into a web browser in order to all developing sites.
Next open /etc/apache2/http.conf and edit the following lines:
DocumentRoot "/Library/WebServer/Documents"
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
and change them to:
DocumentRoot "/Users/<username>/websites"
<IfModule dir_module>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
</IfModule>
My “Computer Name” is argonath, but this should be the “Computer Name” chosen earlier.
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 argonath
Site Configuration
cd /Users/
git clone http://www.zaphinath.com/git/webdevosx.git websites
Then open the browser of your choice and go to the address you chose in the setting up of apache. In my example I go to argonath/ and it will load the web development platform.
Ruby on Rails Configuration
Macport and XCode Tools should both be installed and configured in order to install ruby on rails. I found I had to add a symbolic link to the mysql5 mysqld.sock file because MacPorts puts it in /opt/local and therefore it couldn’t be found at /tmp/mysql.sock.
sudo port install mysql5 +server
sudo port install ruby
sudo port install rb-rubygems
sudo port install rb-termios
sudo port install rb-mysql
sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock
sudo gem update --system
sudo gem install -y rake
sudo gem install rails --include-dependencies
sudo gem install passenger
sudo passenger-install-apache2-module
sudo bundle install
Symfony Configuration
Go to http://symfony.com/download and download the latest version of the Symfony Framework. After the file is unpacked move it to the website directory. This directory is a blank template of the Symfony Project. For every Symfony-php project made just simply copy the Symfony directory into the directory of the new project.
mv ~/Downloads/Symfony ~/websites/Symfony/Symfony
cp ~/websites/Symfony/Symfony ~/websites/Symfony/