V
V
Valery Orlov2018-12-02 16:20:39
Nginx
Valery Orlov, 2018-12-02 16:20:39

What is better to use to redirect to port 80?

Good day. The question is trivial:
What would you advise to use for redirecting NODE.JS applications from 8080 to port 80?
OS Ubuntu 16. By adding a rule to iptables, I achieved the result. I read that NGINX handles this better.
But I only have 3 static pages. The rest of the pages in your personal account are dynamic.
Hence the question: Does it make sense to set up an NGINX proxy for the redirect?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TyzhSysAdmin, 2018-12-02
@lungdesire29

Remove the rule from iptables because it's still a perversion.
Install Nginx and configure proxy_pass, no matter how much you have dynamic and static.

server {
    listen 80;
    server_name hostname.com;
    access_log /var/log/nginx/host-access.log;
    error_log /var/log/nginx/host-error.log;

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question