首页 » 互联网资讯 » 正文

nginx无法实现模块限制速度并发数

nginx无法实现模块限制速度并发数
出现如下错误
  1. nginx: [emerg] unknown directive “log_format” in /usr/local/nginx/conf/nginx.conf:62
nginx配置如下
  1. user  www www;worker_processes 1;error_log  /home/wwwlogs/nginx_error.log  crit;pid        /usr/local/nginx/logs/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.
  2. worker_rlimit_nofile 51200;events
  3. {
  4.   use epoll;
  5.   worker_connections 51200;
  6. }http
  7. {
  8.   include       mime.types;
  9.   default_type  application/octet-stream;  server_names_hash_bucket_size 128;
  10.   client_header_buffer_size 32k;
  11.   large_client_header_buffers 4 32k;
  12.   client_max_body_size 50m;  sendfile on;
  13.   tcp_nopush     on;  keepalive_timeout 60;  tcp_nodelay on;  fastcgi_connect_timeout 300;
  14.   fastcgi_send_timeout 300;
  15.   fastcgi_read_timeout 300;
  16.   fastcgi_buffer_size 64k;
  17.   fastcgi_buffers 4 64k;
  18.   fastcgi_busy_buffers_size 128k;
  19.   fastcgi_temp_file_write_size 256k;  gzip on;
  20.   gzip_min_length  1k;
  21.   gzip_buffers     4 16k;
  22.   gzip_http_version 1.0;
  23.   gzip_comp_level 2;
  24.   gzip_types       text/plain application/x-javascript text/css application/xml;
  25.   gzip_vary on;  # limit_zone   one  $binary_remote_addr  10m;
  26.   server {
  27.     location /www/ {
  28.       limit_conn   one  2;
  29.       limit_rate 300k;
  30.     }
  31.   }
  32. }   #log format
  33.   log_format  access  ‘$remote_addr – $remote_user [$time_local] “$request” ‘
  34.              ‘$status $body_bytes_sent “$http_referer” ‘
  35.              ‘”$http_user_agent” $http_x_forwarded_for’;include vhost/*.conf;
  36. }

————————————————————————————————————————————–

我只能说配置文件已经让你该的面目全非了

只按错误提示log_format放错地方了,要在server前面

发表评论