Macu Gómez
Macu Gómez

Reputation: 1

Can I use Nginx as server and proxy as the same time?

I want to use nginx as reverse proxy and load balancer, but i don't want Apache as server. It's possible to have two or more nginx as the same time? One as proxy and other serving content?

upstream backend_hosts {
    server nginx1;
    server nginx2;
}

server {
    listen 80;
    server_name example.com;

    location /proxy-me {
        proxy_pass http://backend_hosts;
    }
}

Upvotes: 0

Views: 461

Answers (1)

Shawn C.
Shawn C.

Reputation: 6841

Nginx is very capable of hosting a site with one server/location block and being a reverse proxy in another server/location block.

Upvotes: 2

Related Questions