nginx请求编码看起来很奇怪

时间:2016-02-09 12:36:00

标签: nginx

我在使用nginx时遇到了一些问题。请求http头编码看起来很奇怪!?也许anybode可以帮助我。

我在nginx中启用了调试日志记录,这些是我的日志:

client sent invalid method while reading client request line, client: 192.168.1.69, server: , request: "À.]ÐʶHost: 192.168.1.166"

这是我的nginx conf:

user www users;
worker_processes 10;
syslog local1 nginx;
error_log syslog:info;
pid /var/run/nginx.pid;

events {
  worker_connections 256;
  use epoll;
}

http {
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
  client_body_temp_path /opt/senti/var/tmp/www/client/;
  fastcgi_temp_path /opt/senti/var/tmp/www/fastcgi/;
  fastcgi_max_temp_file_size 64m;

  log_format main
    '$remote_addr - $remote_user [$time_local] '
    '"$request" $status $bytes_sent '
    '"$http_referer" "$http_user_agent" '
    '"$gzip_ratio"';

  access_log syslog:info main;
  #access_log off;
  client_header_timeout 10m;
  client_body_timeout 10m;
  send_timeout 10m;
  error_log /opt/senti/var/log/www_error.log debug;

  connection_pool_size 64;
  client_header_buffer_size 1k;
  large_client_header_buffers 4 2k;
  request_pool_size 4k;

  gzip on;
  gzip_min_length 1100;
  gzip_buffers 4 8k;
  gzip_types text/plain;

  output_buffers 1 32k;
  postpone_output 1460;

  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;

  keepalive_timeout 75 20;
  ignore_invalid_headers on;
  index index.html;

  log_format compression '$remote_addr - $remote_user [$time_local] '
                           '"$request" $status $body_bytes_sent '
                           '"$http_referer" "$http_user_agent" "$gzip_ratio"';

  server {
    listen *:80;
    rewrite ^ http://$host$request_uri? permanent;
  }

  server {
    listen *:443;

    ssl on;
    ssl_certificate /etc/nginx/www.crt;
    ssl_certificate_key /etc/nginx/www.key;

    root /opt/senti/var/www;
    location ~ htpasswd$ {
        deny all;
    }
    location / {
       auth_basic Server;
       auth_basic_user_file /etc/nginx/htpasswd;
    }

    location ~ \.json$ {
       auth_basic Server;
       auth_basic_user_file /etc/nginx/htpasswd;

       fastcgi_pass unix:/tmp/ng_web.sock;
       include fastcgi_params;
    }

    location ~(?i)^/services.webapi/api/ {
       fastcgi_pass unix:/tmp/ng_api.sock;
       include fastcgi_params;
    }

    location /services.push/signalr {
        proxy_pass http://unix:/tmp/signalr.socket:/;

        proxy_buffering off;
        # proxy_cache off; NOT SUPPORTED IN v1.4.1
        proxy_set_header Connection "";
        proxy_http_version 1.1;
        chunked_transfer_encoding on;
    }
  }
}

这是我的nginx -V输出:

nginx version: nginx/1.4.1
TLS SNI support enabled
configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/tmp/nginx_log --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=//var/lib/nginx/tmp/client --http-proxy-temp-path=//var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=//var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=//var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=//var/lib/nginx/tmp/uwsgi --with-pcre --add-module=/var/tmp/portage/www-servers/nginx-1.4.1-r5/work/nginx_syslog_patch-0.25 --without-http_autoindex_module --without-http_empty_gif_module --without-http_geo_module --without-http_limit_req_module --without-http_memcached_module --without-http_referer_module --without-http_scgi_module --without-http_ssi_module --without-http_split_clients_module --without-http_upstream_ip_hash_module --without-http_uwsgi_module --with-http_realip_module --add-module=/var/tmp/portage/www-servers/nginx-1.4.1-r5/work/nginx_http_push_module-0.692 --without-http-cache --with-http_ssl_module --without-mail_imap_module --without-mail_pop3_module --with-mail --with-mail_ssl_module --user=nginx --group=nginx

0 个答案:

没有答案