开发者

lighttpd configuration $HTTP["host"]

I am trying to configure my lighttpd server to use a fastcgi module. The recipe I am following ( blindly ) calls for the following line in lighttpd.conf

$HTTP["host"] =~ "(^|\.)example\.com$" {

I am running on a virtual private server, and I do not have a domain name, just an IP. So I assume that I have to re开发者_StackOverflowplace the domain name with my IP - let's say 100.101.102.103

This does not work

$HTTP["host"] =~ "(^|\.)100\.101\.102\.103$" {

Neither does several variations.


You can determine what the value of $HTTP["host"] is for any given request by looking in lighttpd's access log (it's the second entry on a standard log line; it'll show as "-" if the request didn't specify one).

If the log shows you have a fixed IP address, this is a much cleaner test for it:

$HTTP["host"] == "100.101.102.103" {

(though the regular expression you were using should have worked).

What's probably causing confusion here however is the fact that $HTTP["host"] is set to the value of the "Host:" header in the incoming request so it's completely under the control of the client (browser, script, whatever) that's making the request. Knowing what the URL is you are testing with would clarify things a lot.


Do a lookup on your IP address, is there really no DNS name for it? They sually provide a subdomain at the very least.

Lastly, you can just put "*" and it will respond to everything.

Are you using fastcgi? it really makes a difference.


I found that this works:

$SERVER["socket"] == "0.0.0.0:8000" {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜