0

maybe you can help me... I have about 10 wordpress websites that run on the same linux server running on nginx, everything works. Now I have a need to establish new physical linux server (with new linux OS) that would also run nginx websites. The problem is how to do this since they need to run on the same port (80/443) at the same time. I hear something about reverse nginx proxy setup. Is this the solution? If yes, is reverse nginx need to be 3rd server (in front of these two)? Thanks in advance PS sorry for bad English

2
  • What is the goal? Load balancing? High availability? Why not use ready made cloud solutions, like AWS? Mar 27, 2023 at 11:43
  • ...need to upgrade OS version, php version and also reduce the load of existing server. anyway thanks for advice, I'll consider it.
    – cipre
    Mar 28, 2023 at 12:12

1 Answer 1

0

You can set up an nginx reverse proxy on your first server so that it redirects the requests for sites residing on the second server. At the same time, the first one can serve its own sites as usual. Here's some documentation: Nginx reverse proxy

This way your router redirects all web traffic (ports 80 & 443) to the first server. Afterward, the first server decides, based on FQDN, if the site is on the second server. If so, Nginx redirects the traffic to the second server.

You don't redirect any router ports to the second one.

Think of each site as a separate Nginx configuration (never mind if you have a single config file or a separate one for each site). They won't affect each other.

2
  • OK thanks, need to think how to do this because the current websites are in "production" mode. I am worry about collision on ports when I start nginx service on both servers. Hope first server's config script will solve it (:
    – cipre
    Mar 28, 2023 at 12:16
  • As each site is (or can be) a separate configuration file, adding new configurations won't affect your existing sites. You won't have a collision of ports because ports 80 and 443 are redirected only to your first server. Then it's nginx redirects traffic to your second server. Obviously, one should never test new configurations on production and should always use "nginx -t" before reloading the nginx.
    – Smoke
    Apr 4, 2023 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .