Welcome! Log In Create A New Profile

Advanced

Nginx Optimisation

Posted by shayol 
Nginx Optimisation
August 05, 2012 08:22PM
I have a free images hosting and i need to optimisate it. to handle 7000-12000 connection at the same time. My site is an images hosting, and how reach 8000 connection start to load very slow, i think cause of bandwitdh.

CPU and RAM are always low.

These are the statistic:

Active connections: 7888
server accepts handled requests
52602 52602 52019
Reading: 249 Writing: 7638 Waiting: 0

My configuration

user nginx;
worker_processes 4;
worker_rlimit_nofile 20480;

error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

pid /var/run/nginx.pid;


#----------------------------------------------------------------------
# Events Module
#
# http://wiki.nginx.org/NginxHttpEventsModule
#
#----------------------------------------------------------------------

events {
worker_connections 100024;
}


#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.nginx.org/NginxHttpCoreModule
#
#----------------------------------------------------------------------

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

## Request limits
limit_req_zone $binary_remote_addr zone=one:5m rate=2r/s;

## Max Request limits for ip
limit_conn_zone $binary_remote_addr zone=one1:2m;

set_real_ip_from 204.93.240.0/24;
set_real_ip_from 204.93.177.0/24;
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
real_ip_header CF-Connecting-IP;

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

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 0;

gzip on;
gzip_static on;
gzip_vary on;

# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;

geo $country {
default no;
include nginxGeo.txt;
}

}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 308
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready