PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, June 25, 2022

[FIXED] How to set nginx reverse proxy in remote server

 June 25, 2022     cloudflare, digital-ocean, nginx, reverse-proxy     No comments   

Issue

I have one server Server-1 where my app server is running.
In Server-2 I want to set up my Nginx to act as a reverse proxy for my app server.

  1. how do I set up Nginx(in Server-2) which forwards traffic to Server-1
  2. how do I check that everything is working fine, Nginx(Server-2) is acting as a reverse proxy for my app server(Server-1)

Traffic--->Server-2(with Nginx reverse proxy)--->Server-1(with server)


Solution

1) You should add location that will be redirecting all traffic from Server-2 to Server-1, e.g.:

server {
    listen          80;
    server_name     Server-2.com;
    location / {
        proxy_pass  http://Server-1.com/;
    }
}

2) Try load http://Server-2.com page and if everything fine, you will get response from your app on Server-1.com



Answered By - metallic
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing