events { worker_connections 768; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; ## # Gzip Settings ## autoindex on; autoindex_exact_size off; autoindex_localtime on; upstream server_group { server 127.0.0.1:8080 down; server 127.0.0.1:8081 backup; } server { listen 80; access_log /var/log/nginx/cloud.log; #server_name www.xxx.com if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot") { return 403; } #web服务 location / {proxy_pass http://server_group; proxy_next_upstream error timeout invalid_header http_404 http_500 http_502 http_503; } #静态下载 location /static {root /home/ubuntu/; } } (责任编辑:IT) |