<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>NextLogic Singapore Blog: Category Deployment</title>
    <link>http://blog.nextlogic.net/articles/category/deployment</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Ruby on Rails Hosting</title>
      <description>&lt;p&gt;This is a problem I've been (surprisingly) fighting with ever since I've been working with Ruby on Rails. Even though the situation has improved tremendously over the past 2 years it's still far from ideal. I am not sure if it's because insufficient demand or the increased complexity compared to hosting HTML or PHP the big hosting companies don't show much interest in Ruby hosting. Sure they list it as one of the options but the offer and support is flaky at best, many times offering only 1 rails application per account or missing ways to restart FCGI processes. Not surprisingly rails developers had to take the matter in their own hands and as a result almost any RoR hosting worth considering was started like that. I am not sure how much long term market sense it makes but looking at waiting time at slice host it really seems to be working for now.&lt;/p&gt;

&lt;p&gt;When choosing RoR hosting the main decision you have to make is shared hosting vs. VPS. Shared hosting is usually cheaper and easier to set up but you're sharing the server with many other users and it takes only one bad neighbor to make the whole server unusable. VPS, on the other hand, is slightly more expensive and you have to set up everything your self. That gives you a lot of power and flexibility but you have to be able to configure Linux server (it's really no rocket science &#8211; there's plenty of How-To-s on the net &#8211; including this blog).&lt;/p&gt;

&lt;h3&gt;Shared Hosting&lt;/h3&gt;
&lt;p&gt;A few things to watch out for when choosing shared hosting:&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;FCGI support &#8211; most of the hosts offer FCGI (but there are still many that offer only CGI) including an easy way of restarting FCGI processes. You really don't want to open up a support ticket any time you update you application and especially not when you fix a very urgent bug.&lt;/li&gt;
  &lt;li&gt;24/7 Support &#8211; while 24/7 support is claimed to be a standard in hosting industry I am yet to really find the host with this kind of support. That is not to say that the support doesn't matter &#8211; it really does and even if not 24/7 you should really test them out first &#8211; open up tickets outside of business hours, on public holidays, etc. and see the response time as well as helpfulness and professionalism. Many big hosting companies outsource their support offshore and all you'll get outside the working hours is &#8220;I will get a senior technician to look into the problem&#8221;. This is especially important if you're not in different timezone.&lt;/li&gt;
  &lt;li&gt;Number of applications you can host under one account. This includes number of domains, number of subdomains as well as number of databases that you can create. You don't have to worry that much about the actual limits of the server here because if you're not going to utilize the resources it doesn't make them available during peak, it just means that somebody else will.&lt;/li&gt;
  &lt;li&gt;DNS management tools / support. This is not so important if you have 1 application but as the number increases you will have to take care of multiple domains and multiple subdomains under each domain. With the standard shared hosting you will usually only get cPanel that lets you maintain only domains/subdomains hosting on the same server. Reseller account should come with WHM that has proper DNS management tool. Of course you have always option to host your DNS elsewhere.&lt;/li&gt;
  &lt;li&gt;Disk space / bandwidth limits. Usually not a problem with U.S. hosting but most of the hosting companies in Asia still offer 100MB accounts.&lt;/li&gt;
  &lt;li&gt;SSH. It's very hard if not impossible to set up your rails application without SSH access and yet I've seen several hosts (mostly in Asia) to offer ruby hosting without SSH. When I asked how to install the application they asked me for step by step instructions :-). I really don't think you want to do that.&lt;/li&gt;
  &lt;li&gt;SVN hosting &#8211; not crucial but a very nice bonus. It's beneficial even if you're a sole developer as it makes your repository available online. &lt;a href="http://www.railsplayground.com/"&gt;RailsPlayground.Com&lt;/a&gt; even bundles this with Trac.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Looking at the list seems like there's quite a few things to watch out for. From what I've used the best seems to be the &lt;a href="http://www.railsplayground.com/"&gt;RailsPlayground.Com&lt;/a&gt;. They have a very reasonable reasonable support, very few limits and offer quite interesting packages. The downside is that the servers do get overloaded sometimes and then they kill off your processes. This is really bad as the user will get a Rails Application Error but the Exception Notifier will not generate anything and there won't be anything in the logs. I've had several other issues there &#8211; longer HTTP POST will generate application error &#8211; again without any trace in logs and I had some intermittent problems with file upload / download. Other then that I would recommend them as most probably the best RoR shared hosting out there.&lt;/p&gt;

&lt;h3&gt;VPS Hosting&lt;/h3&gt;
&lt;p&gt;VPS experience a stellar launch to popularity over the past year solving most of the problems of shared hosting for only slightly higher price. It had an easy job replacing dedicated hosting offering roughly the same but for 10 times higher price.&lt;/p&gt;
&lt;p&gt;Here are some things to watch out for:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;24/7 Support &#8211; even though it's all maintained by you and you're much less dependent on support, there still will be times when your VPS doesn't come back after restart or doesn't respond due to some runaway processes.&lt;/li&gt;
  &lt;li&gt;Choice of Linux distributions &#8211; many hosts offer a selection of distributions like Ubuntu, Debian, RedHat, etc. You just choose your desired flavor from the menu and it's automatically installed for you. It's really helpful when you have experience with only one Linux flavor or to synchronize your installations when you have multiple servers at several hosting companies.&lt;/li&gt;
  &lt;li&gt;Memory / Price ratio. The only important resource when choosing VPS is memory. Most of them come with sufficient disk space and run on multiprocessor machines but provide only limited memory. Anything below 256MB is not worth considering. You shouldn't pay more then US$ 29 for 256MB and usual price is around US$ 20. Some hosts provide burstable memory which means you can go over your memory limit if nobody else is using it. This can be very helpful during random hit surges or when processing memory extensive tasks. Be very careful as some of the hosts will mercilessly cut off any process that goes about the memory limit causing rails application error without any trace in logs (otherwise great &lt;a href="http://www.vpslink.com/"&gt;VPSLink.com&lt;/a&gt; does that). Another thing to watch out for here is SWAP. While not ideal, it can save your ass during peak requests. Some hosts don't allow any SWAP which will cause your application to crawl when the memory limit is reached.&lt;/li&gt;
  &lt;li&gt;Scalability &#8211; check how easy it is to upgrade your account &#8211; either to increase memory or to add on another server. When number of users increases, adding another server is many times the only option to scale your application.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the best VPS providers is &lt;a href="http://www.slicehost.com/"&gt;Slice Host&lt;/a&gt; providing all of the above for the lowest price on the market. So far, I've experienced only one short downtime. You can choose your Linux distribution, reinstall everything within a few minutes they have no nonsense policies, upgrades in both directions are painless. The only downside is a long waiting list if you're a new user. Another great host is &lt;a href="http://www.rosehosting.com/"&gt;Rose Hosting&lt;/a&gt;. They offer burstable memory and used to have very competitive pricing. I couldn't find any way to add another option to add servers to my account.&lt;/p&gt;

&lt;p&gt;Some general things to watch out for:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;cancellation policy. It's very important to read and understand it as most of the hosts have ridiculous cancellation policies &#8211; like you have to cancel at least 3 months ahead, or only 10 days before the end of the month or only on Monday, Wednesday and Sunday 3 &#8211; 4 am. Also, money back guarantee is much more a dream then reality.&lt;/li&gt;
  &lt;li&gt;Server location. Many people believe believe that the closer the server is to them the faster it is. I've heard many scientific explanations to this, but based on my experience there is usually no difference in access time unless it's on the same subnet (i.e. same provider) which is hardly a case. There is so many other factors (like aggregation, PC speed, last mile connection) that will affect the actual speed that for me it doesn't make any difference in speed for my servers located in the U.S. and servers located in Singapore. The problem with local (Singaporean, Malaysian :-) hosting is that it's several times more expensive, provides several times less resources (like space, bandwidth, memory, etc.) and only 9 &#8211; 5 support. I believe this is due to lack of local competition, lack of market awareness and undue local patriotism. Anyways, ...&lt;/li&gt;
  &lt;li&gt;Backup &#8211; some hosts provide automatic backup for very reasonable price (e.g. Slice Host offers images for US$ 5). While most of the hosts claim to have auto backup it happened to me several times that it took them 2 days to retrieve this backup. As such you should think of your own back up strategy &#8211; one of the ways is to use &lt;a href="http://developer.amazonwebservices.com/"&gt;Amazons AWS&lt;/a&gt;. Most of our customers require direct access to back up files and recovery within 30 minutes (this means that no matter what happens we have to be able get back online within 30 minutes). Another issue is frequency of back up &#8211; most of the auto back up is daily, which is far too little for any production application. Our standard is hourly backup with possibility to increase this during peak hours.&lt;/li&gt;




</description>
      <pubDate>Sat, 28 Jul 2007 22:09:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:7e8abb55-1dba-423d-ba5c-c836a524ab21</guid>
      <author>Peter Bohm</author>
      <link>http://blog.nextlogic.net/articles/2007/07/28/ruby-on-rails-hosting</link>
      <category>Ruby</category>
      <category>Deployment</category>
      <category>Rails</category>
    </item>
    <item>
      <title>Apache 2.2.4 and Mongrel on Ubuntu</title>
      <description>&lt;p&gt;This second installment about installation of the new Apache 2.2.4 and it's configuration for production use with Ruby on Rails and Java. This installment discusses installation of Mongrel and it builds on &lt;a href="http://blog.nextlogic.net/articles/2007/04/10/deployment-using-apache-2-2-4"&gt;installation of apache&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Mongrel Installation&lt;/h2&gt;
&lt;p&gt;Install mongrel and its supporting software. Make sure when prompted you select the most recent, non mswin32 option.
&lt;pre&gt; 
sudo gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies
&lt;/pre&gt;

&lt;h3&gt;Set up mongrel cluster&lt;/h3&gt;
&lt;p&gt;When deploying a mongrel cluster, none of the mongrel servers will be listening on a privileged port. This means that you don't have to run mongrel as root. I usually use just my normal non-root user to run the mongrel cluster. It also helps to avoid problems with file permissions.&lt;/p&gt;

&lt;p&gt;For the purpose of this example we will just use a freshly minted rails app. You can adjust these instructions to work with your app, wherever you may have placed it. I usually put all the applications in /home/peter/rails/. So lets go set up our app and test that mongrel will serve it: &lt;/p&gt;
&lt;pre&gt;
mkdir -p /home/peter/rails/mediacom/releases/
cd /home/peter/rails/mediacom/releases/
rails 1
cd ../
ln -s current releases/1
cd current
mongrel_rails start
&lt;/pre&gt;

&lt;p&gt;You should now be able to see your application at http://host:3000/. If you can, you are good to go. Hit CTRL+C to stop the mongrel server. At a minimum the log directory of your app has to be writable by the peter user: &lt;/p&gt;
&lt;pre&gt;
sudo chown -R peter:peter /home/peter/rails/mediacom/
&lt;/pre&gt;
&lt;p&gt;With mongrel working and our webapp directory prepared we can proceed with the mongrel_cluster configuration step: &lt;/p&gt;
&lt;pre&gt;
sudo mongrel_rails cluster::configure -e production \
    -p 8000 -N 3 -c /home/peter/rails/mediacom/current -a 127.0.0.1 \
    --user peter --group peter
&lt;/pre&gt;

&lt;p&gt;This will write a configuration file in config/mongrel_cluster.yml. We have setup to run our cluster in production mode as the user mongrel and will start 3 mongrel servers listening on ports 8000, 8001, and 8002. Now, lets do a quick test of what we have setup so far:
&lt;/p&gt;
&lt;pre&gt; 
sudo mongrel_rails cluster::start
&lt;/pre&gt;
&lt;p&gt;Checking our host on ports 8000, 8001, and 8002 we should now be able to see our test application. We can stop all of those mongrels with &lt;/p&gt;
&lt;pre&gt;
sudo mongrel_rails cluster::stop.
&lt;/pre&gt;

&lt;h3&gt;On Boot Initialization Setup&lt;/h3&gt;
&lt;p&gt;At this point, mongrel and mongrel_cluster are setup and working with our sample webapp. Ultimately, we want this cluster to start on boot. Fortunately, mongrel_cluster comes with an init script that we can just drop into place. All we need to do is put the configuration files in /etc/mongrel_cluster and take care of a few system tasks: &lt;/p&gt;
&lt;pre&gt;
sudo mkdir /etc/mongrel_cluster
sudo ln -s /home/peter/rails/mediacom/current/config/mongrel_cluster.yml \
    /etc/mongrel_cluster/testapp.yml
&lt;/pre&gt;

&lt;p&gt;The following step needs to be done only once and ofcourse you mongrel_cluster version may vary: &lt;/p&gt;
&lt;pre&gt;sudo cp \
    /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.1/resources/mongrel_cluster \
    /etc/init.d/
sudo chmod +x /etc/init.d/mongrel_cluster 
&lt;/pre&gt;

&lt;p&gt;Now we have a typical System V init script that will launch our mongrel cluster. Actually, this script will launch any cluster that has a configuration file in /etc/mongrel_cluster/. So when we run /etc/init.d/mongrel_cluster start it will start all clusters. Likewise for stop and restart. To install the script use: &lt;/p&gt;
&lt;pre&gt;
sudo /usr/sbin/update-rc.d -f mongrel_cluster defaults
&lt;/pre&gt;

&lt;p&gt;Change the shebang line (the first line) of the mongrel_cluster_ctl to: &lt;/p&gt;
&lt;pre&gt;
#!/usr/local/bin ruby
&lt;/pre&gt;

&lt;h2&gt;Apache configuration&lt;/h2&gt;

&lt;p&gt;Probably the most difficult part. As the apache was compiled from source the configuration files are located quite nonstandardly under /usr/local/apache/conf. As I use the apache for hosting multiple applications (I really wonder how many mongrel instances can such slice host sustain :-) I create a separate folder for configuration files for each of them. This example uses mediacom application and will be accessible from virtual domain mediacom.nextlogic.net. Of course when setting up another application instead of mediacom in files and folder names use the appropriate name :-) &lt;/p&gt;

&lt;p&gt;&lt;b&gt;1) Create folder for configuration files&lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;
mkdir /usr/local/apache/conf/mediacom.conf
cd /usr/local/apache/conf/mediacom.conf
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;2) Create file mediacom.common &lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;
  ServerName mediacom.nextlogic.net
  DocumentRoot /home/peter/rails/mediacom/current/public

  &lt;Directory "/home/peter/rails/mediacom/current/public"&gt;
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;

  RewriteEngine On

  # Uncomment for rewrite debugging
  #RewriteLog logs/myapp_rewrite_log
  #RewriteLogLevel 9

  # Check for maintenance file and redirect all requests
  #  ( this is for use with Capistrano's disable_web task )
  RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
  RewriteCond %{SCRIPT_FILENAME} !maintenance.html
  RewriteRule ^.*$ /system/maintenance.html [L]

  # Rewrite index to check for static
  RewriteRule ^/$ /index.html [QSA]

  # Rewrite to check for Rails cached page
  RewriteRule ^([^.]+)$ $1.html [QSA]

  # Redirect all non-static requests to cluster
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://mongrel_cluster_mediacom%{REQUEST_URI} [P,QSA,L]

  # Deflate
  AddOutputFilterByType DEFLATE text/html text/plain text/css
  # ... text/xml application/xml application/xhtml+xml text/javascript
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

  # Uncomment for deflate debugging
  #DeflateFilterNote Input input_info
  #DeflateFilterNote Output output_info
  #DeflateFilterNote Ratio ratio_info
  #LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
  #CustomLog logs/myapp_deflate_log deflate
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;3) Create mediacom.conf &lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;
  &lt;VirtualHost mediacom.nextlogic.net:80&gt;

    Include conf/mediacom.conf/mediacom.common

  # This is required to convince Rails (via mod_proxy_balancer) that we're
  # actually using HTTPS.
  RequestHeader set X_FORWARDED_PROTO 'https'

    ErrorLog logs/mediacom_errors_log
    CustomLog logs/mediacom_log combined
  &lt;/VirtualHost&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;4) Create mediacom.proxy_cluster.conf &lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;
  &lt;Proxy balancer://mongrel_cluster_mediacom&gt;
    BalancerMember http://127.0.0.1:8000
    BalancerMember http://127.0.0.1:8001
    BalancerMember http://127.0.0.1:8002
  &lt;/Proxy&gt;
&lt;/pre&gt;
&lt;pre&gt;
Note; Of course the port numbers will differ (based on whatever you configured when setting up mongrel cluster. 
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;5) Create mediacom.proxy_frontend.conf &lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;
Listen 8100
&lt;VirtualHost *:8100&gt;
  &lt;Location /&gt;
    SetHandler balancer-manager
    Deny from all
    Allow from peter.dyndns.org
  &lt;/Location&gt;
&lt;/VirtualHost&gt;
&lt;/pre&gt;
&lt;pre&gt;
Note
Ofcourse the port number will have to be unique on the server. Allow access from your current location (or whatever the location you will need the access from) 
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;6) Inform httpd.conf about your configuration files&lt;/b&gt;&lt;br/&gt;
At the following to the very bottom of /usr/local/apache/conf/httpd.conf &lt;/p&gt;
&lt;pre&gt;
Include conf/mediacom.conf/*
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;7) Restart apache and you should be good to go.&lt;/b&gt;&lt;br/&gt;
Of course, you will have to make sure that the virtual host subdomain actually points to the server (i.e. that mediacom.nextlogic.net will actually point to your server - for testing just make an entry in /etc/hosts) 
&lt;pre&gt;
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;8) Go to http://mediacom.nextlogic.net and you should be able to see your app :-)&lt;/b&gt;&lt;/p&gt;


</description>
      <pubDate>Sat, 21 Apr 2007 07:14:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:9c81821a-e6fb-41d2-9a39-8aa26a246182</guid>
      <author>Peter Bohm</author>
      <link>http://blog.nextlogic.net/articles/2007/04/21/apache-2-2-4-and-mongrel-on-ubuntu</link>
      <category>Deployment</category>
    </item>
    <item>
      <title>Deployment Using Apache 2.2.4</title>
      <description>&lt;p&gt;Couple of weeks ago I found a new respect for Apache. I was installing a new VPS and I needed to deploy ruby on rails applications, Java applications and PHP side by side. As the site is for mostly internal use, the traffic was originally quite low, but due to some problems with one of my other hosting providers I was forced to move there some of our external applications with considerably higher traffic. As soon as the traffic grew beyond the resources of this server I realized how easy it was to scale out and instead of moving some of the applications away I was able to retain this server as the main balancer that is sending traffic to servers around.&lt;/p&gt;

&lt;p&gt;Here's a simple walk through for installing Apache 2.2.4 on Ubuntu. It's compiled from various sources &#8211; they are listed below &#8211; of course, they did the tough job :-). I just put everything in one place to provide a complete example.&lt;/p&gt;

&lt;h2&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;As the Apache 2.2.4 is not yet in Ubuntu repositories you will need to do manual installation (i.e. compile from source). Before that you have to make sure that whatever apache installed using apt-get is removed from the system:&lt;/p&gt;
&lt;pre&gt;
sudo dpkg --purge apache apache2 
&lt;/pre&gt;
&lt;p&gt;Install the GCC compilers and developer tools:&lt;/p&gt;
&lt;pre&gt;
sudo apt-get install build-essential
&lt;/pre&gt;
&lt;p&gt;Some extra libraries needed for Ruby/Apache to work:&lt;/p&gt;
&lt;p&gt;Install zlib:&lt;/p&gt;
&lt;pre&gt;
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar xvfz zlib-1.2.3.tar.gz
cd zlib-1.2.3/
./configure
make
sudo make install
&lt;/pre&gt;

alternatively you can use:
&lt;pre&gt;
sudo apt-get install zlib1g zlib1g-dev
&lt;/pre&gt;

Install openssl:
&lt;pre&gt;
sudo apt-get install openssl libssl-dev
&lt;/pre&gt;

Install Readline:
&lt;pre&gt;
apt-get install libreadline5 libreadline5-dev
&lt;/pre&gt;
&lt;p&gt;If you haven't done so already install ruby:&lt;/p&gt;
&lt;pre&gt;
sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 
&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;ONLY FOR 64-bit processors&lt;/b&gt; you will need to use Ruby 1.8.5 or higher to make postresql gem work, which means, you will need to compile it from source. In this case download the latest Ruby source:&lt;/p&gt;
&lt;pre&gt;
wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz
tar -xzf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure
make
sudo make install
&lt;/pre&gt;
Now create a few links to ruby that will be used later (this may or may not be necessary - but no hurt doing it :-):
&lt;pre&gt;
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
&lt;/pre&gt;

Install readline support for ruby:
&lt;pre&gt;
cd ext/readline
ruby extconf.rb
make
sudo make install
cd ../../../
&lt;/pre&gt;

&lt;h2&gt;Apache Installation&lt;/h2&gt;

Download and compile Apache 2.2:
&lt;pre&gt;
wget http://apache.rmplc.co.uk/httpd/httpd-2.2.4.tar.gz
tar -xvf httpd-2.2.4.tar.gz
cd httpd-2.2.4
./configure --prefix=/usr/local/apache --enable-proxy   --enable-proxy-http \
--enable-proxy-balancer --enable-dav --enable-rewrite    --enable-so \
--enable-http   --enable-ssl    --enable-expires  --enable-headers  \
--enable-mods=deflate_module --with-php \
--with-mysql --with-susexec --disable-info  \
--without-berkeley-db --enable-dav=shared \
--enable-dav-lock=shared --with-included-apr
make
sudo make install

ln -s /usr/local/apache/bin/apachectl /usr/sbin/
&lt;/pre&gt;

&lt;h3&gt;Apache at start-up&lt;/h3&gt;
&lt;p&gt;It's a good idea to have Apache start at boot time automatically: &lt;/p&gt;
&lt;pre&gt;
sudo cp /usr/local/apache/bin/apachectl /etc/init.d/apachectl
sudo chmod +x /etc/init.d/apachectl
sudo vim /etc/init.d/apachectl
&lt;/pre&gt;

&lt;p&gt;Add the followinig, so the top of the file looks like: &lt;/p&gt;
&lt;pre&gt;
#!/bin/sh
#
# chkconfig: - 85 15
# description: Apache is a web server.
&lt;/pre&gt;

&lt;p&gt;Now we need to register it with the start-up manager: &lt;/p&gt;
&lt;pre&gt;
sudo /usr/sbin/update-rc.d apachectl defaults
&lt;/pre&gt;

&lt;h3&gt;Securing Apache&lt;/h3&gt;
&lt;p&gt;It's also a good idea to create a dedicate Apache system user account. It'll make your install more secure. &lt;/p&gt;
&lt;pre&gt;
sudo adduser --system apache
&lt;/pre&gt;

&lt;p&gt;To make apache actually use it edit the configuration file: &lt;/p&gt;
&lt;pre&gt;
sudo vim /usr/local/apache/conf/httpd.conf
&lt;/pre&gt;

&lt;p&gt;You need to find the lines that say: &lt;/p&gt;
&lt;pre&gt;
User daemon
Group daemon
&lt;/pre&gt;
&lt;p&gt;And change them so they look like: &lt;/p&gt;
&lt;pre&gt;
User apache
Group nogroup
&lt;/pre&gt;

&lt;h3&gt;Install PHP&lt;/h3&gt;
&lt;p&gt;While you're at it install the PHP as well... You may need to install bison and flex first: &lt;/p&gt;
&lt;pre&gt;
sudo apt-get install bison
sudo apt-get install flex
&lt;/pre&gt;

&lt;p&gt;Download the php from www.php.net. In my case it was PHP4: &lt;/p&gt;
&lt;pre&gt;
wget http://sg.php.net/distributions/php-4.4.6.tar.gz
tar -xzf php-4.4.6.tar.gz
cd php-4.4.6
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql

make
sudo make install

sudo cp php.ini-dist /usr/local/lib/php.ini

&lt;/pre&gt;

&lt;p&gt;Add the following to httpd.conf (sudo vim /usr/local/apache/conf/httpd.conf) - put it somewhere around the other AddType definitions:&lt;/p&gt;
&lt;pre&gt; 
AddType application/x-httpd-php .php .phtml
&lt;/pre&gt;

&lt;p&gt;Update line 
 &lt;pre&gt;DirectoryIndex index.html&lt;/pre&gt;
to 
 &lt;pre&gt;DirectoryIndex index.html index.php&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;Restart apache and you're done &lt;/p&gt;
&lt;pre&gt;
sudo apachectl restart
&lt;/pre&gt;

&lt;p&gt;Wow! We're done with the first part. Once you're done here you're able to add the actual deployment servers. Here are some of my favorite:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mongrel Cluster to deploy Ruby on Rails applications&lt;/li&gt;
&lt;li&gt;Tomcat to deploy Java applications&lt;/li&gt;
&lt;/ul&gt;

&lt;br/&gt;&lt;br/&gt;
&lt;h3&gt;&lt;a name="section-UbuntuRailsApacheMongrel-References"&gt;References&lt;/a&gt;&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a class="external" href="http://www.simplisticcomplexity.com/2006/8/13/apache-2-2-mod_proxy_balancer-mongrel-on-ubuntu-6-06"&gt;http://www.simplisticcomplexity.com/2006/8/13/apache-2-2-mod_proxy_balancer-mongrel-on-ubuntu-6-06&lt;/a&gt;&lt;img class="outlink" src="images/out.png" alt=""&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a class="external" href="http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/"&gt;http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/&lt;/a&gt;&lt;img class="outlink" src="images/out.png" alt=""&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a class="external" href="http://mongrel.rubyforge.org/docs/apache.html"&gt;http://mongrel.rubyforge.org/docs/apache.html&lt;/a&gt;&lt;img class="outlink" src="images/out.png" alt=""&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a class="external" href="http://mongrel.rubyforge.org/docs/mongrel_cluster.html"&gt;http://mongrel.rubyforge.org/docs/mongrel_cluster.html&lt;/a&gt;&lt;img class="outlink" src="images/out.png" alt=""&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a class="external" href="http://www.kodefoo.com/2007/2/18/deploying-rails-on-ubuntu-dapper/"&gt;http://www.kodefoo.com/2007/2/18/deploying-rails-on-ubuntu-dapper/&lt;/a&gt;&lt;img class="outlink" src="images/out.png" alt=""&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a class="external" href="http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/"&gt;http://davidwinter.me.uk/articles/2006/10/17/building-apache-22-from-source-for-ubuntu-dapper/&lt;/a&gt;&lt;img class="outlink" src="images/out.png" alt=""&gt;

&lt;/li&gt;
&lt;/ul&gt;


</description>
      <pubDate>Tue, 10 Apr 2007 09:32:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:5be04479-c40b-4074-a1ed-3021fa4b9def</guid>
      <author>Peter Bohm</author>
      <link>http://blog.nextlogic.net/articles/2007/04/10/deployment-using-apache-2-2-4</link>
      <category>Deployment</category>
      <category>apache</category>
      <category>2.2.4</category>
      <category>Ubuntu</category>
    </item>
  </channel>
</rss>
