nginx无法实现模块限制速度并发数
nginx无法实现模块限制速度并发数出现如下错误nginx: unknown directive "log_format" in /usr/local/nginx/conf/nginx.conf:62nginx配置如下userwww www;worker_processes 1;error_log/home/wwwlogs/nginx_error.logcrit;pid /usr/local/nginx/logs/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.worker_rlimit_nofile 51200;events
{
use epoll;
worker_connections 51200;
}http
{
include mime.types;
default_typeapplication/octet-stream;server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;sendfile on;
tcp_nopush on;keepalive_timeout 60;tcp_nodelay on;fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;# limit_zone one$binary_remote_addr10m;
server {
location /www/ {
limit_conn one2;
limit_rate 300k;
}
}
} #log format
log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';include vhost/*.conf;
} # limit_zone one$binary_remote_addr10m;
把#去掉好吧……? 我只能说配置文件已经让你该的面目全非了
只按错误提示log_format放错地方了,要在server前面 原帖由 licess 于 2012-11-3 16:53 发表 https://bbs.vpser.net/images/common/back.gif
我只能说配置文件已经让你该的面目全非了
只按错误提示log_format放错地方了,要在server前面
对于下面的源码,该怎么写呢?
userwww www;worker_processes 1;error_log/home/wwwlogs/nginx_error.logcrit;pid /usr/local/nginx/logs/nginx.pid;#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;events
{
use epoll;
worker_connections 51200;
}http
{
include mime.types;
default_typeapplication/octet-stream;server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;sendfile on;
tcp_nopush on;keepalive_timeout 60;tcp_nodelay on;fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
limit_zonecrawler$binary_remote_addr50m;
#log format
log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';include vhost/*.conf;
} 顶上去看看
:handshake 军哥怎么不说下 https://bbs.vpser.net/thread-3017-1-1.html
回复 6# 的帖子
可是文章中并没有提及到怎么限制速度,只是限制了并发数回复 6# 的帖子
安装提示在后面加了limit_conn oneip 20;提示这个nginx: zero size shared memory zone "oneip"
回复 7# 的帖子
加个 limit_rate ××k;不就行了回复 9# 的帖子
不行,提示如下Stoping LNMP...
Nginx program is stop
Shutting down php_fpm . done
PHP-FPM program is stop
MySQL program is not runing!
Starting LNMP...
nginx: zero size shared memory zone "oneip"
Nginx start successfully!
Starting php_fpmdone
PHP-FPM start successfully!
Starting MySQL SUCCESS!
MySQL start successfully!
回复 9# 的帖子
还是不行啊这样的话会出错,但是不知道该怎么处理 肯定是server段前没加上limit_zoneoneip$binary_remote_addr10m; :lol :victory: :handshake 已经搞定了
页:
[1]