What's new

nginx "reverse proxy" configuration

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

WildWurger

Occasional Visitor
Hi Merlin and all,

I searched through and follow the guides like, how to prep ext3 usb and installing entware, after installing, i then install nginx, my purpose is just to redirect from like http://host1.domain.com to internal host:8080. i am going to do a few A records like these as i only have 1 IP address.

however i just need the simplest possible configuration rather than most guides with involve installing other like php and so on.

i have done through installed the nginx and able to edit the eninx.conf, however i stucked here and not really sure how to move on.

by just starting nginx without any configuration give me these errors

admin@RT-N66U:/tmp/mnt/4GB/entware/etc/nginx# nginx
nginx: [emerg] bind() to 0.0.0.0:80 failed (125: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (125: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (125: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (125: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (125: Address already in use)
nginx: [emerg] still could not bind()
admin@RT-N66U:/tmp/mnt/4GB/entware/etc/nginx#

i really appreciate Merlin or any other members who can guide me from this stage... and is there any firewall rules i need to take note?

Thank you in advance
 
Hi, thanks for the tip! however i went into Administration and System, it only let me choose between HTTP/ HTTPS and BOTH, while if i choose HTTPS, it let me define my own port, the HTTP option seems to default to port 80 without letting me change.

firmware version is 3.0.0.4.270.26

Thanks!
 
Hi all, hopefully someone please can help me, i had change the RT-N66U port to https 8443 port, therefore leaving port 80 open for nginx,

however despite i tried to look for alot of examples from the net , but come to no avail, please help me, what should i do exactly on the nginx configuration...

i just need the most simplest redirection like

remote.com, host1.remote.com, host2.remote.com all pointing to a same dynamic ip address (which updated by DDNS)

what should i configure in my RT-N66U nginx?

so that remote.com will point to rt-n66u:8443, host1.remote.com will point to local1:5000 and host2.remote.com will point to local2:8080

Thank you very much, any help is greatly appreciated, im desperate...

this is my nginx.conf


http {
server {
listen 80;
server_name host1.remote.com;
location / {
proxy_pass http://192.168.1.70:5000;
proxy_set_header host host1.remote.com;
}
}
}

http {
server {
listen 80;
server_name host2.remote.com;
location / {
proxy_pass http://192.168.1.71:5000;
proxy_set_header host host2.remote.com;
}
}
}

then i added this to iptables

admin@RT-N66U:/tmp/home/root# iptables -A INPUT -p tcp --dport 80 -j ACCEPT

i saved and restarted the iptables
starting nginx seems no problem too...

on the WAN side, remote.com, host1.remote.com, host2.remote.com all pointed to the same IP address

i only installed nginx, didnt install the apache or lightttp... as i not sure if i need it or not... it seems no need

please anybody enlighten me... i really really do appreciate your kind help


Thank you
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top