1、内核优化

net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 30000
net.core.somaxconn = 262144
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.ip_conntrack_max = 6553600
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 180
net.ipv4.tcp_window_scaling = 1
net.ipv4.ip_local_port_range = 1024    65000
net.ipv4.tcp_timestamps = 0


2、设置文件描述符

请参照http://linux008.blog.51cto.com/2837805/547654

3、nginx优化配置

user  www www;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
error_log  /usr/local/nginx/logs/error.log  warn;
worker_rlimit_nofile 65536;

events
{
      use epoll;
      worker_connections 65536;
}

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

        server_names_hash_bucket_size 128;

        keepalive_timeout 60;
        client_header_buffer_size    4k;   //系统分页大小#getconf PAGESIZE
        client_max_body_size         32m;
        large_client_header_buffers  8 1024k;
        client_header_timeout  3m;
        client_body_timeout    3m;
        send_timeout           3m;
        connection_pool_size        256;
        request_pool_size        4k;
        output_buffers   16 128k;
        postpone_output  1460;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 16 256k;
        fastcgi_busy_buffers_size 512k;
        fastcgi_temp_file_write_size 512k;
        fastcgi_temp_path /dev/shm;

        open_file_cache max=65536 inactive=20s;
        open_file_cache_min_uses 1;
        open_file_cache_valid 30s;


        tcp_nodelay on;
        gzip on;
        gzip_static on;
        gzip_proxied        any;
        gzip_disable        "MSIE [1-5]."
        gzip_comp_level     9;
        gzip_min_length  1k;
        gzip_buffers     16 128k;
        gzip_http_version 1.0;
        gzip_types       text/plain application/x-javascript text/css application/xml;
        server_name_in_redirect off;
        log_format  access  '$remote_addr $remote_user - [$time_local] "$request" '
                            '$status $body_bytes_sent "$http_referer" '
                            '"$http_user_agent" $http_x_forwarded_for';
        include /usr/local/nginx/conf/vhost/*.conf;
}

4、vhost配置

   #vim /usr/local/nginx/conf/vhost/a.conf
   server
   {
    listen 80;
    server_name www.abc.com;
    root /data/httpd/csm.shopex.cn;
    index index.php index.html index.htm;
    location ~ .*\.php?$
    {
            include fastcgi.conf;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
    }
    #access_log  /var/log/nginx/nginx-access.log access;
    }

 

爱慕尔商城欢迎您的光临!
穿衣打扮  
城市物语