vhost/status.conf:
server {
listen 80 default deferred; # 默认的server
server_name _; # 只接受IP访问
access_log /var/log/nginx/status_access.log;
location /nginx_status {
stub_status on; # 打开status监控
access_log off;
allow 127.0.0.1;
deny all;
}
}
nginx.conf:
user fcgi;
worker_processes 4; # nginx进程数
worker_cpu_affinity 0001 0010 0100 1000; #进程所使用的cpu号
worker_rlimit_nofile 65535; # 进程所打开的句柄数
events {
use epoll;
worker_connections 10240;
}
http {
server_tokens off; # 当nginx出现错误页面时不显示版本号
gzip on;
gzip_types text/xml text/css application/x-javascript;
gzip_min_length 1000;
gzip_vary on; #让Nginx前端的Squid 2.5/2.6缓存服务器能够缓存经过gzip压缩的页面。
gzip_comp_level 9;
...
}
#打开cache
http{} 里加入:
proxy_cache_path /opt/nginx/proxy_temp levels=1:2 keys_zone=CNAME:30m max_size=2m ;
location /app{
access_log /var/log/nginx/access_cache.log cache;
proxy_cache_key $host$request_uri;
proxy_pass ;
proxy_cache CNAME;
proxy_cache_valid 200 301 302 10m;
}
参考
阅读(1087) | 评论(0) | 转发(0) |