sudo apt-get install ntp

server 1.cn.pool.ntp.org

server 1.asia.pool.ntp.org

server 0.asia.pool.ntp.org

groupadd nginx

useradd -M -s /sbin/nologin nginx -g nginx

sudo apt-get install gcc g++ make automake

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz

wget http://zlib.net/zlib-1.2.8.tar.gz

./configure  \

--prefix=/usr/local/nginx \  

--with-http_stub_status_module    #支持NGINX状态查询

--with-http_spdy_module              #支持GOOGLE的SPDY

--with-http_ssl_module                 #支持HTTPS

 --with-http_gzip_static_module   ##预压缩文件传前检查,防止文件被重复压缩

--with-pcre                                     #支持rewrite重写功能

--user=nginx \

--group=nginx \

--http-log-path=/var/log/nginx/access.log \

--error-log-path=/var/log/nginx/error.log \

make && make install

server{

    listen 80;

    server_name ~^(.+)?\.supuy\.com$;

    access_log /var/log/nginx/xxx.xxx.xxx_access.log combined;

    location / {

        proxy_redirect off;

        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://xxx.xxx.xxx.xxx;

    }

    location ~* \.(tgz|rar|bz2|zip|7z|tar|gz|bz|Z|)$

    {

        root html;

        return 404;

    }

}



修改nginx.conf 
添加
worker_rlimit_nofile 65535;


修改/etc/security/limits.conf
添加
* soft nofile  655360
* hard nofile 655360
fs.file-max=65535
net.ipv4.tcp_syncookies = 1 
#
net.ipv4.tcp_fin_timeout = 30 
#
net.ipv4.tcp_tw_reuse = 1
#
net.ipv4.tcp_tw_recycle = 1
#
net.ipv4.ip_local_port_range = 1024 65000
#
net.ipv4.tcp_max_syn_backlog = 65536 
#
net.ipv4.tcp_max_tw_buckets = 6000
#
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
#
net.ipv4.tcp_synack_retries = 1

net.core.somaxconn = 65535 
#
net.core.netdev_max_backlog = 262144
#
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_max_orphans = 262144
#