Make lighttpd listen on multiple ports

时光总嘲笑我的痴心妄想 提交于 2019-12-10 17:34:34

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/14331794/make-lighttpd-listen-on-multiple-ports

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!