????4??url_hash??????????
??????????url??hash?????????????????url?????????????????????????????????????Ч??
??????????upstream?м???hash???server????в???д??weight?????????????hash_method??????hash??
????upstream backend {
????server squid1:3128;
????server squid2:3128;
????hash $request_uri;
????hash_method crc32;
????}
????tips:
????upstream bakend{#???帺??????豸??Ip???豸??}{
????ip_hash;
????server 127.0.0.1:9090 down;
????server 127.0.0.1:8080 weight=2;
????server 127.0.0.1:6060;
????server 127.0.0.1:7070 backup;
????}
???????????????????server??????
????proxy_pass http://bakend/;
????????豸?????????:
????1.down????????server???????????
????2.weight?weight??????????????
????3.max_fails?????????????????????1.??????????????????proxy_next_upstream??鶨??????
????4.fail_timeout:max_fails??????????????
????5.backup?? ???????е??backup????down??????????????backup????????????????????????
????nginx??????????????????????????????server????á?
????client_body_in_file_only?????On ?????client post?????????????????????????debug
????client_body_temp_path???ü????????? ?????????3????
????location??URL???????.???????????????????μ???? ???????
????##?????????
????server
????{
????listen 80;
???????ü??????
????server_name image.***.com;
???????÷???????
????location ~* .(mp3|exe)$ {
????????“mp3??exe”??β???????и??????
????proxy_pass http://img_relay$request_uri;
????????????????????????????????URL
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
???????????У????????????????????????????????????????????
????}
????location /face {
????if ($http_user_agent ~* "xnp") {
????rewrite ^(.*)$ http://211.151.188.190:8080/face.jpg redirect;
????}
????proxy_pass http://img_relay$request_uri;
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
????error_page 404 502 = @fetch;
????}
????location @fetch {
????access_log /data/logs/face.log log404;
????rewrite ^(.*)$ http://211.151.188.190:8080/face.jpg redirect;
????}
????location /image {
????if ($http_user_agent ~* "xnp") {
????rewrite ^(.*)$ http://211.151.188.190:8080/face.jpg redirect;
????}
????proxy_pass http://img_relay$request_uri;
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
????error_page 404 502 = @fetch;
????}
????location @fetch {
????access_log /data/logs/image.log log404;
????rewrite ^(.*)$ http://211.151.188.190:8080/face.jpg redirect;
????}
????}
????##????????
????server
????{
????listen 80;
????server_name *.***.com *.***.cn;
????location ~* .(mp3|exe)$ {
????proxy_pass http://img_relay$request_uri;
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
????}
????location / {
????if ($http_user_agent ~* "xnp") {
????rewrite ^(.*)$ http://i1.***img.com/help/noimg.gif redirect;
????}
????proxy_pass http://img_relay$request_uri;
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
????#error_page 404 http://i1.***img.com/help/noimg.gif;
????error_page 404 502 = @fetch;
????}
????location @fetch {
????access_log /data/logs/baijiaqi.log log404;
????rewrite ^(.*)$ http://i1.***img.com/help/noimg.gif redirect;
????}
????}
????server
????{
????listen 80;
????server_name *.***img.com;
????location ~* .(mp3|exe)$ {
????proxy_pass http://img_relay$request_uri;
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
????}
????location / {
????if ($http_user_agent ~* "xnp") {
????rewrite ^(.*)$ http://i1.***img.com/help/noimg.gif;
????}
????proxy_pass http://img_relay$request_uri;
????proxy_set_header Host $host;
????proxy_set_header X-Real-IP $remote_addr;
????proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
????#error_page 404 http://i1.***img.com/help/noimg.gif;
????error_page 404 = @fetch;
????}
????#access_log off;
????location @fetch {
????access_log /data/logs/baijiaqi.log log404;
????rewrite ^(.*)$ http://i1.***img.com/help/noimg.gif redirect;
????}
????}
????server
????{
????listen 8080;
????server_name ngx-ha.***img.com;
????location / {
????stub_status on;
????access_log off;
????}
????}
????server {
????listen 80;
????server_name imgsrc1.***.net;
????root html;
????}
????server {
????listen 80;
????server_name ***.com w.***.com;
????# access_log /usr/local/nginx/logs/access_log main;
????location / {
????rewrite ^(.*)$ http://www.***.com/ ;
????}
????}
????server {
????listen 80;
????server_name *******.com w.*******.com;
????# access_log /usr/local/nginx/logs/access_log main;
????location / {
????rewrite ^(.*)$ http://www.*******.com/;
????}
????}
????server {
????listen 80;
????server_name ******.com;
????# access_log /usr/local/nginx/logs/access_log main;
????location / {
????rewrite ^(.*)$ http://www.******.com/;
????}
????}
????location /NginxStatus {
????stub_status on;
????access_log on;
????auth_basic "NginxStatus";
????auth_basic_user_file conf/htpasswd;
????}