title: Make lighttpd listen on multiple ports
body: <p>I have a lighttpd server running on an AWS EC2 instance. It can serve on port 80 (or any other port, if I change server.port in /etc/lighttpd/lighttpd.conf) with no problems. However, when I serve an alternative document-root on a different port (say, 8080), browsers can never connect to the server.</p>
  
  <p>The relevant section of my lighttpd.conf file:</p>
  
  <pre><code>server.port = 80
  
  ##
  ## Use IPv6?
  ##
  server.use-ipv6 = "disable"
  
  ##
  ## bind to a specific IP
  ##
  #server.bind = "localhost"
  
  ##
  ## Run as a different username/groupname.
  ## This requires root permissions during startup. 
  ##
  server.username  = "lighttpd"
  server.groupname = "lighttpd"
  
  ## 
  ## enable core files.
  ##
  #server.core-files = "disable"
  
  ##
  ## Document root
  ##
  server.document-root = server_root + "/release"
  $SERVER["socket"] == ":8080" {
          server.document-root = server_root + "/dev"
  }
  </code></pre>
  
  <p>Full file <a href="http://pastebin.com/BDn0RaLN" rel="noreferrer">here</a></p>
  
  <p>The site rooted at <code>server_root + "/dev"</code> works fine - I have tested by reversing their port assignations, in which case /dev loads fine on :80 and /release is not found.</p>
  
  <p>I've read numerous guides (e.g. <a href="http://kevinworthington.com/lighttpd-mini-howto-using-different-ports-with-same-urlip-address/" rel="noreferrer">here</a>, <a href="http://redmine.lighttpd.net/projects/1/wiki/Docs_Configuration" rel="noreferrer">official docs</a>, <a href="http://forum.lighttpd.net/topic/85" rel="noreferrer">here</a>, etc.), to no avail. The first of these mentioned that there might be a firewall conflict, but I don't know how to resolve that on EC2, and the fact that I can set <code>server.port=8080</code> with no problem makes me think this is not the issue.</p>
  
  <p>Both folders are owned by my <code>lighttpd</code> user, which has full rights in both folders.</p>
  
  <p>I don't see anything of note in log files when making a request to <code>&lt;my address&gt;:8080</code>.</p>