ExpressionEngine on Ubuntu Server via VMware
Up until now XAMPP was my personal choice of local development server. It is quick and easy to setup on Windows based computers. But like any other server environment software it has drawbacks in terms of stability and speed. These become more obvious when working on multiple projects that require client access during ExpressionEngine development stage.
Since starting with ExpressionEngine v2, I had to go through reconfiguring my base install template and while switching I thought I should try a different local development setup as well.
Result is now I'm running Ubuntu Server 10.04 (Lucid Lynx) via VMware Server 2 locally and boy! I am seeing lightning fast elapsed times.
First Steps for ExpressionEngine sandbox
We need to download server software VMware Server, Ubuntu Server and to access the server I prefer using WinSCP. There are countless help topics & videos on how to setup virtual LAMP server so you'll need to do a bit of Googling to do. Basically, you first install VMWare on your computer and setup LAMP server on top of that. Once done connect to the server with WinSCP because there are few files we'll need to edit in order to get the server going the way we want.
Ubuntu Server Settings
Server needs to have a static IP internally so we can utilise port forwarding which I will explain later.
/etc/network/interfaces is the file to edit for static IP. My current setup is
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
By default Apache server creates /var/www folder to host web files. Let's leave that folder alone and create /var/www_sites instead. This is where we're going to develop our sites, so for each client work there will be following folders created
client1-domain.com
http
system
client2- domain.com
http
system
As you can see by doing this we're also making sure ExpressionEngine system folder is above public domain for extra security.
Obviously we need to tell Apache server what we've done by editing /etc/apache2/httpd.conf file. Below is what I have in that file
<VirtualHost *:80>
DocumentRoot "/var/www"
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www_sites/client1- domain.com/http"
ServerName client1.webunder.com.au
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www_sites/client2- domain.com/http"
ServerName client2.webunder.com.au
</VirtualHost>
First declaration will take default requests to main server. Second and third declarations will forward to appropriate folder depending on which sub domain is requested. Keep in mind that these VirtualHost declarations are bare minimum and I suggest exploring further for options.
Resolving ExpressionEngine sites
This part should be quite smooth as we're required to make one addition to our modem. Remembering the static IP 192.168.0.10 we had earlier, we need to add a forward rule from Public Port 80 to 192.168.0.10 with Private Port 80.
This will cover what goes on once traffic reaches our location but we also need to create Custom A records on domain level so the domains requested can find their way to us. These days most ISP's put you on plans with static IP or you can use dynamic DNS services such no-ip.com which is free.
Once you know your modems public IP address go to your domain hosting panel and add Custom A records such as
Name: client1.webunder.com.au
Data: modems static IP
Name: client2.webunder.com.au
Data: modems static IP
These sub domains should now point to your development server where you put ExpressionEngine installation files and publically reachable by your client. Keep in mind that this is a basic tutorial to get you going and there is much more to customise if you want to delve in to server settings.
