• nginx 日志配置

    日期:

    分享下it.net.cn的nginx日志配置: log_format main $remote_addr [$time_iso8601] $host $request $status $body_bytes_sent $request_time $http_referer $http_user_agent $upstream_cache_status; access_log logs/access.log main; error_log logs/error...

  • nginx缓存了空响应导致之后的请求都返回空的解决方案

    日期:

    在it.net.cn的日志中出现了很多返回的状态号为200但是Content-Length为0的日志记录,类似下面的记录: 1.202.219.10 - - [01/Mar/2013:22:51:56 +0800] HEAD / HTTP/1.1 200 0 - Mozilla/5.0 (compatible; JikeSpider; +http://shoulu.jike.com/spider.html)...

  • nginx配置泛域名

    日期:

    nginx可以通过通配符方便的配置泛域名,如下是outofmemory.cn的泛域名配置 server { #listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 listen 80; server_name *.outofmemory.cn;...

  • nginx作为反向代理是如何取得代理的具体服务器

    日期:

    nginx作为反向代理是如何取得代理的具体服务器, 例如有如下nginx配置: upstream frontends { server 127.0.0.1:8000; server 127.0.0.1:8001; server 127.0.0.1:8002; [...] } server { location / { proxy_pass http://frontends; [...] } [...] }可以在ng...

  • Nginx虚拟主机,虚拟目录配置实例

    日期:

    两个虚拟主机(纯静态-html 支持) - Two Virtual Hosts, Serving Static Files http { server { listen 80; server_name outofmemory.cn; access_log logs/outofmemory.cn.access.log main; location / { index index.html; root /var/www/domain1.com/htdocs;...

  • nginx gzip压缩配置设置方法

    日期:

    gzip(GNU-ZIP)是一种压缩技术。经过gzip压缩后页面大小可以变为原来的30%甚至更小,这样,用户浏览页面的时候速度会块得多。gzip的压缩页面需要浏览器和服务器双方都支持,实际上就是服务器端压缩,传到浏览器后浏览器解压并解析。浏览器那里不需要我们担心,...

  • nginx防DDOS攻击的简单配置

    日期:

    近期由于工作需要,做了些防DDOS攻击的研究,发现nginx本身就有这方面的模块ngx_http_limit_req_module和ngx_http_limit_conn_module。 一、基本介绍 1.ngx_http_limit_req_module 配置格式及说明: 设置一个缓存区保存不同key的状态,这里的状态是指当前的...

  • nginx配置防止ddos攻击和cc攻击

    日期:

    经常会有一些无聊的人,对网站发起ddos攻击或者cc攻击。 可以在nginx上做一下限制来防止类似攻击。如下配置nginx.conf文件内容: ## # Basic Settings ## keepalive_timeout 30; types_hash_max_size 2048; ## # Performance Settings ## sendfile on; tcp_no...

  • nginx让指定站点支持SSI(Server side include)

    日期:

    nginx自带的模块就可以支持SSI,OutOfMemory.CN的文档站点doc.outofmemory.cn就被配置成了支持ssi的。 如下是支持ssi的配置部分: #doc.outofmemory.cn server { listen 80; server_name doc.outofmemory.cn; access_log /www/logs/doc.outofmemory.cn/access...

  • nginx配置文件nginx.conf详细解释

    日期:

    #使用哪个用户启动nginx 前面是用户,后面是组 user www www; #nginx工作的进程数量 worker_processes 2; # [ debug | info | notice | warn | error | crit ] 错误日志的位置 error_log /var/htdocs/logs/nginx_error.log crit; #进程号保存文件 pid /usr/loc...