Project

General

Profile

Reverse proxy

Added by jeanmarc almost 11 years ago

Hi,

I am a newbie and i know the solution should be trivial but i am now struggling since hours to make a reverse proxy :/
I need to forward the adress http://myip/ipcam/ to a local IP cam (192.168.1.5), i suppose using "mod_proxy".

What can be wrong in my conf file ?

Thanks indeed for your work !

# lighttpd -t -f /etc/lighttpd/lighttpd.conf

### Load server modules
server.modules = (
"mod_alias",
"mod_access",
"mod_auth",
"mod_status",
"mod_proxy",
"mod_compress",
"mod_accesslog" 
)

server.port        = 80
server.username        = "http" 
server.groupname    = "http" 
server.document-root    = "/srv/http" 
server.errorlog        = "/var/log/lighttpd/error.log" 
dir-listing.activate    = "enable" 
status.status-url    = "/status" 
#tunning
server.max-connections = 128
server.max-keep-alive-idle = 5
server.max-keep-alive-requests = 16
server.max-read-idle = 60
server.max-write-idle = 360

## PHP
include "conf.d/fastcgi.conf" 

## Compressing
compress.cache-dir = "/tmp/lighttpd/" 
compress.filetype = ("text/plain","text/css","text/xml","text/javascript") 

# Reverse proxy
proxy.debug = 1
$HTTP["url"] =~ "^/ipcam/" {
    proxy.server = ( "" => 
    ( (
            "host" => "192.168.1.5",
            "port" => 80
        ) )
    )
}

index-file.names    = ( "index.php","index.html" )
# mimetype mapping
mimetype.assign = (
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".pac" => "application/x-ns-proxy-autoconfig",
".dat" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tgz" => "application/x-tgz",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".asc" => "text/plain",
".c" => "text/plain",
".h" => "text/plain",
".cc" => "text/plain",
".cpp" => "text/plain",
".hh" => "text/plain",
".hpp" => "text/plain",
".conf" => "text/plain",
".log" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".diff" => "text/plain",
".patch" => "text/plain",
".ebuild" => "text/plain",
".eclass" => "text/plain",
".rtf" => "application/rtf",
".bmp" => "image/bmp",
".tif" => "image/tiff",
".tiff" => "image/tiff",
".ico" => "image/x-icon",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
".tar.gz" => "application/x-tgz",
".bz2" => "application/x-bzip",
".gz" => "application/x-gzip",
".tar" => "application/x-tar",
".zip" => "application/zip",
".jpeg" => "image/jpeg",
".jpg" => "image/jpeg",
".png" => "image/png",
".gif" => "image/gif",
".xhtml" => "text/html",
".html" => "text/html",
".htm" => "text/html",
".dtd" => "text/xml",
".xml" => "text/xml",
".css" => "text/css",
".js" => "text/javascript",
".deb" => "application/x-deb",
".php" => "application/x-httpd-php",
"" => "text/plain",
)

Replies (1)

RE: Reverse proxy - Added by jeanmarc almost 11 years ago

Hi,

I still can't get it to work :|

I use :

$HTTP["host"] =~ "192.168.1.2|xxx.xxx.org" {
$HTTP["url"] =~ "^/ipcam/" {
proxy.server = (
"" => ((
"host" => "192.168.1.5",
"port" => 80
#"fix-redirects" => 1
))
)
}
}

errorlog give:

2013-05-28 14:38:55: (mod_proxy.c.1142) proxy - start
2013-05-28 14:38:55: (mod_proxy.c.1183) proxy - ext found
2013-05-28 14:38:55: (mod_proxy.c.1317) proxy - found a host 192.168.1.5 80
2013-05-28 14:38:55: (mod_proxy.c.396) connect delayed: 7
2013-05-28 14:38:55: (mod_proxy.c.998) proxy: fdevent-out 1
2013-05-28 14:38:55: (mod_proxy.c.1027) proxy - connect - delayed success
2013-05-28 14:38:55: (mod_proxy.c.967) proxy: fdevent-in 4
2013-05-28 14:38:55: (mod_proxy.c.665) proxy - have to read: 328
2013-05-28 14:38:55: (mod_proxy.c.967) proxy: fdevent-in 4
2013-05-28 14:38:55: (mod_proxy.c.665) proxy - have to read: 0
2013-05-28 14:38:55: (mod_proxy.c.1142) proxy - start

What can be wrong ? I have Lighttpd 1.4.32
Thks

    (1-1/1)