February 2018
Beginner to intermediate
348 pages
9h 40m
English
The first step is to enable proxying of requests in your location blocks. Since the proxy_pass directive cannot be placed at the http or server level, you need to include it in every single place that you want forwarded. Usually, a location / { fallback block suffices, since it encompasses all requests, except those that match location blocks containing a break statement.
The following is a simple example using a single static backend hosted on the same server:
server {
server_name .example.com;
root /home/example.com/www;
[...]
location / {
proxy_pass http://127.0.0.1:8080;
}
}
In the following example, we make use of an upstream block, allowing us to specify multiple servers:
upstream apache { server 192.168.0.1:80; ...Read now
Unlock full access