More than 1 webserver behind DD-WRT

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Thu Sep 04, 2008 8:50    Post subject: More than 1 webserver behind DD-WRT Reply with quote
Using nginx as a reverse proxy I am now able to run more than 1 webserver on my home network.
Currently nginx is still running on a Fedora-core system because nginx doesn't run (yet) on DD-WRT.

Nginx is now in the optware library but alas, it doesn't work because it needs to be compiled in a different way.

I already made a script which will write part of the config automatically.


Code:
# cat /opt/etc/nginx/parse_hosts
CONFDIR=/tmp/nginx/conf.d
CONF=${CONFDIR}/dd-wrt_hosts.conf
mkdir -p ${CONFDIR}
mkdir /var/log/nginx 2>/dev/null
rm -f ${CONF}
touch ${CONF}

_write_conf ()
{
 echo -e "\nserver {\n" >>${CONF}
 echo -e " listen\t8080;" >>${CONF}
 echo -e " server_name\t${HOST_NAME};\n" >>${CONF}
 echo -e " access_log  /var/log/nginx/${HOST_NAME}.log;" >>${CONF}
 echo -e " location / {" >>${CONF}
 echo -e "  proxy_pass\thttp://${HOST_IP};" >>${CONF}
 echo -e "  proxy_set_header Host \$http_host;\n }\n}" >>${CONF}
}

cat /etc/hosts | grep -v -e 0.0.0.0 -e localhost | while read HOST_ENTRY
do
  HOST_IP=`echo $HOST_ENTRY | awk '{print $1}'`
  HOST_NAME=`echo $HOST_ENTRY | awk '{print $2}'`
  _write_conf
done
cat /tmp/dnsmasq.conf | grep ^address= | while read HOST_ENTRY
do
  HOST_IP=`echo $HOST_ENTRY | cut -d/ -f3`
  HOST_NAME=`echo $HOST_ENTRY | cut -d/ -f2`
  _write_conf
done

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)


Last edited by frater on Thu Sep 04, 2008 12:26; edited 2 times in total
Sponsor
teclis22
DD-WRT User


Joined: 28 Sep 2006
Posts: 272

PostPosted: Thu Sep 04, 2008 12:00    Post subject: Reply with quote
Aloah !
If you are at a state of runing multiple web servers at home maybe an upgrade to a firwall distribution like IpCop might be a consequent step for you to concider.

Regards

tec

_________________
2x Buffalo WHR-HP-G300N in AP
2x Buffalo WHR-HP-G300N in WDS (not working atm)
1x Buffalo WHR-HP-G300N in Wireless Client-Bridge (not working atm)
1x Buffalo WHR-HP-G300N in Reserve (still looking for that on ebay)

all units running DD-WRT v3.0-r44187 std
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Thu Sep 04, 2008 12:18    Post subject: Reply with quote
No...
I love little appliances that do all the work...

More than 1 webserver doesn't mean I'm running a small hosting company. My satellite-receiver has a webserver, my xbox, my Windows machine and my NAS

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Wed Sep 10, 2008 7:00    Post subject: Reply with quote
It is working...
Thanks to bzhou who updated the nginx in the optware feed.

I will do some testing and will write the howto asap.

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
smudgeface
DD-WRT Novice


Joined: 24 Jan 2008
Posts: 20

PostPosted: Wed Sep 10, 2008 7:52    Post subject: Reply with quote
I'm very interested in your results! Please follow up as soon as you can.

thanks
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Wed Sep 10, 2008 9:10    Post subject: Reply with quote
Don't set your expectations too high.
Although it is working fine in concept, preliminary testing shows it's a too heavy burden on the MIPS-cpu.

Discrete http-traffic is no problem, but when I was browsing my photo-website whilst looking with top on my router, I saw nginx taking up 98% of CPU and my hi-res photos were crawling.

When running nginx on my Fedora-system, this is totally not the case. I even have the feeling it speeds things up, but this can also be my enthousiasm that it's actually working ;-)

Maybe someone knows about another application that's more specific for this application. Nginx can do a lot more than what I want it to do and this may be the reason it's taking up all the processing power. It only needs to read the http-header and route everyting to the appropriate server.

I think I'll still publish an howto

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Wed Sep 10, 2008 16:42    Post subject: Reply with quote
I will now look at haproxy to see if this will give me more performance on the DD-WRT router.
Is there someone else who tried pound or any other reverse proxy?

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
frater
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 2777

PostPosted: Thu Sep 11, 2008 13:36    Post subject: Reply with quote
I switched from nginx (EngineX) to Pound, which is less versatile.
It turned out it is much faster and uses less resources. I'm still testing it and I will have to change the scripts that are writing the config-file...

Hold on!

If there's anyone who tried one of the proxies, please step forward.

_________________
Asus RT16N + OTRW
Kingston 4GB USB-disk 128 MB swap + 1.4GB ext3 on /opt + 2 GB ext3 on /mnt
Copperjet 1616 modem in ZipB-config
Asterisk, pixelserv & Pound running on router
Another Asus RT16N as WDS-bridge

DD-WRT v24-sp2 vpn (c) 2010 NewMedia-NET GmbH
Release: 12/16/10 (SVN revision: 15758M)
gvk
DD-WRT Novice


Joined: 19 Nov 2012
Posts: 10

PostPosted: Sun Nov 25, 2012 17:26    Post subject: Need help running nginx on my e3200...!!! Reply with quote
Hi frater,

I need some steps help me running nginx on my e3200. I have flashed dd-wrt.v24-19519_NEWD-2_K2.6_big-nv60k.bin onto it. Please help me

Thanks

frater wrote:
Don't set your expectations too high.
Although it is working fine in concept, preliminary testing shows it's a too heavy burden on the MIPS-cpu.

Discrete http-traffic is no problem, but when I was browsing my photo-website whilst looking with top on my router, I saw nginx taking up 98% of CPU and my hi-res photos were crawling.

When running nginx on my Fedora-system, this is totally not the case. I even have the feeling it speeds things up, but this can also be my enthousiasm that it's actually working Wink

Maybe someone knows about another application that's more specific for this application. Nginx can do a lot more than what I want it to do and this may be the reason it's taking up all the processing power. It only needs to read the http-header and route everyting to the appropriate server.

I think I'll still publish an howto
gvk
DD-WRT Novice


Joined: 19 Nov 2012
Posts: 10

PostPosted: Wed Nov 28, 2012 16:14    Post subject: Re: Need help running nginx on my e3200...!!! Reply with quote
Hi Frater,

I am able to run Nginx on lingsys-e3200 with dd-wrt big build.

Here I want to disable default httpd and make nginx as the default server, Please help me with some inputs...

Thanks.

gvk wrote:
Hi frater,

I need some steps help me running nginx on my e3200. I have flashed dd-wrt.v24-19519_NEWD-2_K2.6_big-nv60k.bin onto it. Please help me

Thanks

frater wrote:
Don't set your expectations too high.
Although it is working fine in concept, preliminary testing shows it's a too heavy burden on the MIPS-cpu.

Discrete http-traffic is no problem, but when I was browsing my photo-website whilst looking with top on my router, I saw nginx taking up 98% of CPU and my hi-res photos were crawling.

When running nginx on my Fedora-system, this is totally not the case. I even have the feeling it speeds things up, but this can also be my enthousiasm that it's actually working Wink

Maybe someone knows about another application that's more specific for this application. Nginx can do a lot more than what I want it to do and this may be the reason it's taking up all the processing power. It only needs to read the http-header and route everyting to the appropriate server.

I think I'll still publish an howto
madman999
DD-WRT Guru


Joined: 11 Jun 2012
Posts: 1042

PostPosted: Wed Nov 28, 2012 17:52    Post subject: Reply with quote
you might not be having any luck trying to find an answer in a 4 year old thread but what benefit does Nginx give you over using OTRW and Lighttpd or running an external separate webserver?

i just want to know what solution does it provide for you?

_________________
Please state what make and model router plus the build number and type of DD-WRT you are using. Screen prints and a network diagram can are also helpful. Before you create a new post, use the search function. Chances are your issue has happened to someone else.

Common F.A.Q.
Where can I get the latest test Firmware or older ones?
https://download1.dd-wrt.com/dd-wrtv2/downloads/betas/

Asus RT-AC66R on 3.x 28072 Giga
TP-Link Archer C9 on 3.x r54095
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum