使lighttpd侦听多个端口 [英] Make lighttpd listen on multiple ports

查看:383
本文介绍了使lighttpd侦听多个端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在AWS EC2实例上运行的lighttpd服务器.它可以在端口80上使用(如果我在/etc/lighttpd/lighttpd.conf中更改server.port,则可以在任何其他端口上使用),没有问题.但是,当我在其他端口(例如8080)上提供备用文档根目录时,浏览器将永远无法连接到服务器.

我的lighttpd.conf文件的相关部分:

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

完整文件此处

植根于server_root + "/dev"的站点可以正常工作-我已经通过反转端口分配进行了测试,在这种情况下/dev在:80上可以正常加载,而/release找不到.

我已经阅读了许多指南(例如此处官方文档解决方案

抱歉,我现在可以回答自己的问题.

这确实是防火墙问题,但修复起来非常简单-转到console.aws.amazon.com(如有必要,请登录),选择相关的安全组,并添加允许传入流量的防火墙规则在该端口上-如果您希望限制访问,则从特定来源访问;对于通用访问,则从0.0.0.0/0开始.

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.

解决方案

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.

这篇关于使lighttpd侦听多个端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆