nginx简单使用
worker_processes 4; //一般是电脑核数的2倍 表示nginx启动时的进程数 worker_cpu_affinity 0001 0010 0100 1000; //指定了nginx在工作时候使用的cpu worker_rlimit_nofile 65535; //这个指令是指当一个nginx进程打开的最多文件描述符数目
参考 http:
//www.howtocn.org/nginx:%E9%85%8D%E7%BD%AE%E4%B8%80%E4%B8%AA%E9%AB%98%E6%80%A7%E8%83%BD%E7%9A%84nginx_fastcgi%E6%9C%8D%E5%8A%A1%E5%99%A8
events { use epoll; worker_connections 65535; } http { include mime.types; default_type application/octet-stream; sendfile on; client_header_buffer_size 4k; keepalive_timeout 65; client_max_body_size 100m; charset utf-8; proxy_ignore_client_abort on; upstream oceanus { server 127.0.0.1:21530; } upstream wm { server 127.0.0.1:21520; } server { listen 80; server_name www.zjifa.com.cn; if ( $uri = '/' ){ rewrite .* /index.html break; } location ~ ^/good(D|Z|X)/([0-9]+)$ { rewrite ^/good(D|Z|X)/([0-9]+)$ /productsList.html?category$1=$2; } location ~ ^/article/([0-9]+)$ { rewrite ^/article/([0-9]+)$ /articleList.html?categoryID=$1; } #swf location ~ ^/crossdomain.xml { root /data/oceanus/enterprise/static/html; } location ~ ^/www/upfiles/.+ { root /data/oceanus/enterprise/oceanus-21530-21535-21536/webapps/; } 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://oceanus; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name i.zjifa.com.cn; if ( $uri = '/' ){ rewrite .* /user/login.html break; } 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://wm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name static.zjifa.com.cn; location ~ ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) { rewrite ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) /goods/pre_/$1_$arg_m.$2?version=$arg_version; } location ~ ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) { rewrite ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) /goods/$1/$2/$3/$4_$arg_m.$5?version=$arg_version; } location ~ ^/www/upfiles/.+ { root /data/oceanus/enterprise/static/html/; } location / { root /data/oceanus/enterprise/static/html; } } server { listen 80; server_name image.zjifa.com.cn; location ~ ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) { rewrite ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) /goods/pre_/$1_$arg_m.$2?version=$arg_version; } location ~ ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) { rewrite ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) /goods/$1/$2/$3/$4_$arg_m.$5?version=$arg_version; } location ~ ^/advertisement/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) { rewrite ^/advertisement/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) /advertisement/$1/$2/$3/$4_$arg_m.$5?version=$arg_version; } location ~ ^/www/upfiles/.+ { root /data/oceanus/enterprise/static/image/; } location / { root /data/oceanus/enterprise/static/image; } } }
每一天的成长!