0

I'm trying to construct reverse proxy server using nginx on centos 7.

I installed nginx and also nodejs for local web server.

I would like to redirect requests on nginx to local nodejs server (http://localhost:5000).

So, following this page www.packethead.net/2015/01/05/setup-nginx-reverse-proxy/

, i modified /etc/nginx/nginx.conf file like below.

server {
    listen 80;
    server_name *.example.org; # my domain
    location / {
    proxy_set_header x-real-IP $remote_addr;
    proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
    proxy_set_header host $host;
    proxy_pass http://127.0.0.1:5000;
   }
}

Then, using systemctl restart nginx.service command, I restartd nginx.

When i access example.org on browser, just i can see this.

enter image description here

Is there any special configuration which have to be added? Is my above configuration file not correct??

I can not even guess what's fault.

I watched many explanation for reverse proxy.

Can you guys recommend easy explanations for me?

Thanks for watch.

  • 1
    "redirect", or "proxy". They're two very different things. – womble Aug 7 '15 at 6:13
  • 1
    Is your node.js server listening on 127.0.0.1? – Michael Hampton Aug 7 '15 at 6:40
  • Yes. the server listening on localhost. – duckdeok Aug 7 '15 at 9:52
  • Sorry for misuse. I mean proxy. not redirect. – duckdeok Aug 7 '15 at 9:54
-1

The proxy did not work because of firewall of centos 7. After shutdown the firewall, It have been working^^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.