1. 轉發ip和端口
listen 9800;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /{
proxy_pass http://11.55.38.60:9800;#轉發請求的地址
proxy_set_header HTTP_X_FORWARDED_FOR "$remote_addr:$remote_port" ;
proxy_set_header Host $host:$server_port;
proxy_connect_timeout 60s;
proxy_read_timeout 300s;
proxy_send_timeout 60s;
}
2. 帶地址
listen 9800; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /pacs{ proxy_pass http://11.55.38.60:9800/pacs;#轉發請求的地址 proxy_set_header HTTP_X_FORWARDED_FOR "$remote_addr:$remote_port" ; proxy_set_header Host $host:$server_port; proxy_connect_timeout 60s; proxy_read_timeout 300s; proxy_send_timeout 60s; }
3. 轉發多個分發
upstream nuc { server 192.168.200.154:6303;# max_fails=2 fail_timeout=10s; server 10.30.28.43:9003;# max_fails=2 fail_timeout=10s; #server 10.30.28.43:9004;# max_fails=2 fail_timeout=10s; #keepalive 128; --新增 } server { listen 9063; server_name sc.shou.cn; #這里是域名 #root /data/web; root html; location /nuc { root html; #root /data/web; try_files $uri $uri/ @router index index.html index.htm; } ... }