<?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: Tag apache</title>
    <link>http://blog.nextlogic.net/articles/tag/apache</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <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>
