Client -----> Agent ------> server
Forward Proxy and Reverse Proxy
- Forward proxy client <-----> ----- Proxy> server
- Reverse Proxy Client ------> proxy <----> server
The difference is that the object is not the same proxy, forward proxy is a server , reverse proxy is a client.
Lunix: netstat -luntp | grep nginx #查看nginx监听的端口号
MAC: netstat -lnat |grep LISTEN
Proxy Configuration:
Forward Proxy
important point:
1. Increase dns resolution resolver
2. Increase server server_name no name
3.proxy_pass instruction
resolver 8.8.8.8;
server {
listen 8088;
location / {
proxy_pass http://$http_host$request_uri;
}
}
Reverse Proxy
location /proxy/ {
proxy_pass http://127.0.0.1:9000/;
}
Other configuration parameters
The instruction is opened in response to proxy server from the rear end of the buffer contents. If the buffer is turned on, Nginx supposed to be back-end proxy server responds with the fastest speed, and the content stored in the instruction.
proxy_buffering
语法: proxy_buffering on|off
默认值: proxy_buffering on
上下文: http, server, location
扩展 : proxy_buffer_size 、 proxy_buffer_size 、proxy_buffers
Redirect 301
proxy_redirect
语法: proxy_redirect [ default|off|redirect replacement ]
默认值: proxy_redirect default
上下文: http, server, location
Head Configuration
proxy_set_header
语法: proxy_set_header header value
默认值: Host and Connection
上下文: http, server, location
## 配置
proxy_set_header Host $proxy_host;
proxy_set_header Connection Close;
Timeout time_out
proxy_connect_timeout
语法: proxy_connect_timeout timeout_in_seconds
上下文: http, server, location
proxy_read_timeout
语法: proxy_read_timeout the_time
默认值: proxy_read_timeout 60
上下文: http, server, location