<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[ErikDaRed]]></title>
  <link href="http://erikdared.com/atom.xml" rel="self"/>
  <link href="http://erikdared.com/"/>
  <updated>2012-04-02T22:53:03-04:00</updated>
  <id>http://erikdared.com/</id>
  <author>
    <name><![CDATA[Erik Nelson]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Lighttpd + Jetty using mod_proxy]]></title>
    <link href="http://erikdared.com/blog/2012/02/08/lighttpd-plus-jetty-using-mod-proxy/"/>
    <updated>2012-02-08T14:36:00-05:00</updated>
    <id>http://erikdared.com/blog/2012/02/08/lighttpd-plus-jetty-using-mod-proxy</id>
    <content type="html"><![CDATA[<p>I recently setup lighttpd on my home server when I did a full wipe. Up until now it&#8217;s just been hosting the map for my Minecraft server (which I&#8217;ve been using <a href="http://overviewer.org/">Overviewer</a> to generate). I&#8217;ve recently been working on some Java web apps on the side and I wanted to be able to access these over port 80.</p>

<p>In the past I&#8217;ve had some experience doing this with Apache&#8217;s HTTP server, but I&#8217;m pretty new to lighttpd still. It actually ended up being very easy to set this up for lighttpd, as you&#8217;ll see. I&#8217;m using Ubuntu 11.10 Server Edition for this tutorial.</p>

<h2>Preparation</h2>

<p>You&#8217;ll need to have lighttpd and jetty up and running already. This isn&#8217;t very hard as lighttpd runs fine out of the box on Ubuntu. Jetty, on the other hand, doesn&#8217;t start by default due to a configuration setting. Let&#8217;s fix that now.</p>

<p>Look for this line and change the value to 0:</p>

<pre><code># change to 0 to allow Jetty to start
NO_START=1
</code></pre>

<p>Now go to <a href="http://localhost:8080">http://localhost:8080</a> (or whatever your server address may be) to make sure Jetty is running correctly. If so you can go ahead and deploy your war file to:</p>

<pre><code>/usr/share/jetty/webapps
</code></pre>

<p>If all goes well you should be able to access your application over port 8080.</p>

<h2>Configure mod_proxy</h2>

<p>mod_proxy is very easy to setup. You&#8217;ll want to edit the module&#8217;s configuration file at:</p>

<pre><code>/etc/lighttpd/conf-available/10-proxy.conf
</code></pre>

<p>and add the following lines:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$HTTP["url"] =~ "^/PATH_TO_APP" {
</span><span class='line'>  proxy.server = (
</span><span class='line'>    "" =&gt; ((
</span><span class='line'>      "host" =&gt; "127.0.0.1",
</span><span class='line'>      "port" =&gt; 8080
</span><span class='line'>    ))
</span><span class='line'>  )
</span><span class='line'>}</span></code></pre></td></tr></table></div></figure>


<p>Obviously you&#8217;ll want to change the &#8220;PATH_TO_APP&#8221; to the path for your application on Jetty (it&#8217;s also advisable to leave off the trailing slash since doing so will allow URLs with and without the trailing slash to proxy correctly).</p>

<p>Also, notice the empty quotes on the third line: this means that all requests for that path will be passed to Jetty. If you want to restrict it to a certain file type, you can use something like &#8220;.jsp&#8221; instead.</p>

<h2>Enable mod_proxy</h2>

<p>Now that the configuration is complete, you&#8217;ll want to enable mod_proxy and reload lighttpd&#8217;s configuration. This can be done by executing the following commands:</p>

<pre><code>sudo lighttpd-enable-mod proxy
sudo service lighttpd force-reload
</code></pre>

<p>All done! Now you should be able to access your Java web application over port 80.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Getting Started with Octopress on Ubuntu 11.10]]></title>
    <link href="http://erikdared.com/blog/2012/01/02/getting-started-with-octopress-on-ubuntu-11-dot-10/"/>
    <updated>2012-01-02T15:56:00-05:00</updated>
    <id>http://erikdared.com/blog/2012/01/02/getting-started-with-octopress-on-ubuntu-11-dot-10</id>
    <content type="html"><![CDATA[<p>I thought I&#8217;d write up a little how-to on setting up Octopress on Ubuntu 11.10, since I ran into some issues on a fresh install.</p>

<h2>Install RVM</h2>

<p>RVM is a version manager for Ruby, more information <a href="http://beginrescueend.com/">here</a></p>

<pre><code>bash &lt; &lt;(curl -s https://rvm.beginrescueend.com/install/rvm)
</code></pre>

<p>Add RVM to your shell</p>

<pre><code>echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] &amp;&amp; . "$HOME/.rvm/scripts/rvm" # Load RVM function' &gt;&gt; ~/.bash_profile
source ~/.bash_profile
</code></pre>

<h2>Install Ruby 1.9.2</h2>

<p>Install some dependencies first:</p>

<pre><code>rvm pkg install zlib
rvm pkg install openssl
</code></pre>

<p>I had some issues with ruby not finding openssl, for this reason we&#8217;re going to use the version that was just installed to your rvm path.</p>

<p>Install Ruby:</p>

<pre><code>rvm install 1.9.2 --with-openssl-dir=$rvm_path/usr
rvm rubygems latest  # This will make sure rubygems is the latest version
rvm use 1.9.2
</code></pre>

<h2>Setup Octopress</h2>

<pre><code>git clone git://github.com/imathis/octopress.git octopress
cd octopress    # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes).
ruby --version  # Should report Ruby 1.9.2
</code></pre>

<h2>Install dependencies for Octopress</h2>

<pre><code>gem install bundler
bundle install
</code></pre>

<h2>Install Octopress with default settings</h2>

<pre><code>rake install
</code></pre>

<h2>Configure Octopress</h2>

<p>Nothing special required here, just follow the <a href="http://octopress.org/docs/configuring/">Official Docs</a>.</p>

<h2>All Finished!</h2>

<p>Everything should be working just fine now. Go ahead and follow the instructions <a href="http://octopress.org/docs/blogging/">here</a> to make your first post.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Hello World]]></title>
    <link href="http://erikdared.com/blog/2012/01/02/hello-world/"/>
    <updated>2012-01-02T15:25:00-05:00</updated>
    <id>http://erikdared.com/blog/2012/01/02/hello-world</id>
    <content type="html"><![CDATA[<p>Hi there! I&#8217;m attempting at setting up my site again so I can blog about stuff that I&#8217;m doing and to share other interesting things.</p>

<p>I&#8217;m using <a href="http://octopress.org">Octopress</a>, you should check it out!</p>
]]></content>
  </entry>
  
</feed>

