Make lighttpd listen on multiple ports
Asked Answered
M

2

8

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.

The relevant section of my lighttpd.conf file:

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"
}

Full file here

The site rooted at server_root + "/dev" works fine - I have tested by reversing their port assignations, in which case /dev loads fine on :80 and /release is not found.

I've read numerous guides (e.g. here, official docs, here, 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 server.port=8080 with no problem makes me think this is not the issue.

Both folders are owned by my lighttpd user, which has full rights in both folders.

I don't see anything of note in log files when making a request to <my address>:8080.

Marbling answered 15/1, 2013 at 5:42 Comment(0)
M
5

Whoops, I can now answer my own question.

It was, indeed, a firewall issue, but it was very simple to fix - go to console.aws.amazon.com (log in if necessary), select the relevant security group, and add a firewall rule allowing incoming traffic on that port - either from a particular source if you wish to restrict access, or from 0.0.0.0/0 for universal access.

Marbling answered 16/1, 2013 at 8:43 Comment(0)
M
1

Just configure the firewall which will create firewall rules that will allow all connections on port 80.

sufo ufw allow 80

Once the rules are added,then try hitting the url in the browser.

Marilla answered 10/4, 2019 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.