ใช้ config นี้อยู่ครับที่ได้จากใน THT
จะ config เพิ่ม ให้ limit speed download / per ip ได้ยังไงครับ ขอบคุณล่วงหน้าครับ
user apache apache;
worker_processes 4; # Set it according to what your CPU have. 4 Cores = 4
worker_rlimit_nofile 8192;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
server_tokens off;
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log crit;
server_names_hash_bucket_size 64;
sendfile on;
tcp_nopush on;
tcp_nodelay off;
keepalive_timeout 30;
gzip on;
gzip_comp_level 9;
gzip_proxied any;
proxy_buffering on;
proxy_cache_path /etc/nginx/proxy_temp levels=1:2 keys_zone=one:15m inactive=7d max_size=1000m;
proxy_buffer_size 16k;
proxy_buffers 100 8k;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
server {
listen IP-ADDRESS:85 default rcvbuf=8192 sndbuf=16384 backlog=32000; # Real IP here
server_name domain.name _ ; # "_" is for handle all hosts that are not described by server_name
charset off;
access_log off;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://IP-ADDRESS; # Real IP here และไม่มี / ปิดท้าย
client_max_body_size 16m;
client_body_buffer_size 128k;
proxy_buffering on;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 120;
proxy_buffer_size 16k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
location ~* ^/(phpmyadmin|webmail|squirrelmail|uebimiau|roundcube)/.+\.(jpg|jpeg|gif|png|ico|css|zip|tar|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|wmv|avi|cur|swf|mp3|wma|htc|cur)$ {
root /var/www/html/;
expires 30d;
access_log off;
}
location ~* ^/(stats)/.+\.(jpg|jpeg|gif|png|html|htm)$ {
root /var/www/html/;
access_log off;
}
location ~* ^/(mrtg|imrtg)/.+\.(jpg|jpeg|gif|png|html|htm)$ {
root /var/www/html/;
access_log off;
}
location /nginx_status {
stub_status on;
access_log off;
allow IP-ADDRESS; # Real IP here
allow 127.0.0.1;
deny all;
}
if ($http_host = "") {
return 444;
}
}
# เพื่อไว้สำหรับคนที่จะแยกค่า conf นะครับ. ไฟล์ตามด้านล่างของผมคือไฟล์ว่างเปล่า
include /etc/nginx/etc/*.conf;
}