- 浏览: 837058 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
zjhzwx1212:
为什么用threadLocal后,输出值是从20开始的,而定义 ...
j2ee的线程安全--threadlocal -
aeoluspu:
不错 mysql 测试部分感觉不详细
用sysbench(或者super-smack)测试mysql性能 -
nanPrivate:
有没有例子,只理论,实践起来还是不会啊
JMS可靠消息传送 -
lwclover:
一个网络工程师 装什么b
postfix 如何删除队列中的邮件 -
maimode:
我也欠缺不少啊
理想的计算机科学知识体系
http://brainspl.at/articles/2007/01/03/new-nginx-conf-with-optimizations
# user and group to run as
user ez ez;
# number of nginx workers
worker_processes 6;
# pid of nginx master process
pid /var/run/nginx.pid;
# Number of worker connections. 1024 is a good default
events {
worker_connections 1024;
}
# start the http module where we config http access.
http {
# pull in mime-types. You can break out your config
# into as many include's as you want to make it cleaner
include /etc/nginx/mime.types;
# set a default type for the rare situation that
# nothing matches from the mimie-type include
default_type application/octet-stream;
# configure log format
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# main access log
access_log /var/log/nginx_access.log main;
# main error log
error_log /var/log/nginx_error.log debug;
# no sendfile on OSX
sendfile on;
# These are good default values.
tcp_nopush on;
tcp_nodelay off;
# output compression saves bandwidth
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml
application/xml+rss text/javascript;
# this is where you define your mongrel clusters.
# you need one of these blocks for each cluster
# and each one needs its own name to refer to it later.
upstream mongrel {
server 127.0.0.1:5000;
server 127.0.0.1:5001;
server 127.0.0.1:5002;
}
# the server directive is nginx's virtual host directive.
server {
# port to listen on. Can also be set to an IP:PORT
listen 80;
# Set the max size for file uploads to 50Mb
client_max_body_size 50M;
# sets the domain[s] that this vhost server requests for
# server_name www.[engineyard].com [engineyard].com;
# doc root
root /data/ez/current/public;
# vhost specific access log
access_log /var/log/nginx.vhost.access.log main;
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
location / {
# needed to forward user's IP address to rails
proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
proxy_max_temp_file_size 0;
# If the file exists as a static file serve it directly without
# running all the other rewite tests on it
if (-f $request_filename) {
break;
}
# check for index.html for directory index
# if its there on the filesystem then rewite
# the url to add /index.html to the end of it
# and then break to send it to the next config rules.
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
# this is the meat of the rails page caching config
# it adds .html to the end of the url and then checks
# the filesystem for that file. If it exists, then we
# rewite the url to have explicit .html on the end
# and then send it on its way to the next config rule.
# if there is no file on the fs then it sets all the
# necessary headers and proxies to our upstream mongrels
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /data/ez/current/public;
}
}
# This server is setup for ssl. Uncomment if
# you are using ssl as well as port 80.
server {
# port to listen on. Can also be set to an IP:PORT
listen 443;
# Set the max size for file uploads to 50Mb
client_max_body_size 50M;
# sets the domain[s] that this vhost server requests for
# server_name www.[engineyard].com [engineyard].com;
# doc root
root /data/ez/current/public;
# vhost specific access log
access_log /var/log/nginx.vhost.access.log main;
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
location / {
# needed to forward user's IP address to rails
proxy_set_header X-Real-IP $remote_addr;
# needed for HTTPS
proxy_set_header X_FORWARDED_PROTO https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
proxy_max_temp_file_size 0;
# If the file exists as a static file serve it directly without
# running all the other rewite tests on it
if (-f $request_filename) {
break;
}
# check for index.html for directory index
# if its there on the filesystem then rewite
# the url to add /index.html to the end of it
# and then break to send it to the next config rules.
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
# this is the meat of the rails page caching config
# it adds .html to the end of the url and then checks
# the filesystem for that file. If it exists, then we
# rewite the url to have explicit .html on the end
# and then send it on its way to the next config rule.
# if there is no file on the fs then it sets all the
# necessary headers and proxies to our upstream mongrels
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://mongrel;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /data/ez/current/public;
}
}
}
- nginx.conf.txt.zip (1.8 KB)
- 下载次数: 8
发表评论
-
sysctl.conf
2011-07-06 14:54 1708fs.file-max=51200 net.core.net ... -
top的替代工具
2011-06-28 15:06 1430dstat -cgilpymn collectl and ... -
有用的小工具
2010-12-23 11:51 1298pv stream nessus Nikto ski ... -
调优linux i/o 行为
2010-11-25 11:27 2878http://www.westnet.com/~gsmith/ ... -
服务器部署工具
2010-11-12 16:32 2010http://www.linuxlinks.com/artic ... -
开源的配置管理工具
2010-11-12 16:24 1414最佳开源配置管理工具: Puppet / 提名:OpenQ ... -
优化ext3的mount选项
2010-11-12 10:24 1283defaults,commit=600,noatime,nod ... -
恢复r710biso 出厂设置
2010-11-10 10:30 1182ALT+E/F/B -
每进程io监控工具
2010-11-02 14:14 1619iodump iotop iopp pidstat b ... -
Intel Xeon 5500/5600系列 CPU服务器内存设置
2010-11-01 21:29 4773http://www.xasun.com/article/2a ... -
zabbix短信报警脚本文件
2010-10-21 14:28 2743附件 -
天外飞仙级别的Linux Shell命令
2010-10-16 09:59 1360本文编译自commandlinefu.com ( 应该是 Ca ... -
lenny+r710+lvm 重启问题解决方案
2010-10-15 14:22 1071ro rootdelay=10 quiet -
fai,debian 自动安装工具
2010-10-15 13:36 1074http://sys.firnow.com/linux/x80 ... -
十个服务器监控工具
2010-09-26 11:44 1788一位国外的技术博主在 ... -
restrict authorized_keys
2010-09-06 09:45 1213command="/home/someuser/rs ... -
sysctl优化设置
2010-09-05 11:25 1083sysctl 是一个用来在系统运作中查看及调整系统参数的工 ... -
proc文件系统
2010-09-05 11:22 1213什么是proc文件系统? proc文件系统是一个伪 ... -
nfs使用
2010-09-02 17:01 1117http://www.linuxhomenetworking. ... -
lsof example
2010-08-23 12:40 12331、查看文件系统阻塞 ...
相关推荐
nginx配置优化 每个参数都有详细的解释,包含多线程,负载均衡 ,无效联系我:351137017
第3章 Nginx的基本配置与优化.pdf 第4章 Nginx与PHP(FastCGI)的安装、配置与优化.pdf 第5章 Nginx与JSP、ASP.NET、Perl的安装与配置.pdf 第6章 Nginx HTTP负载均衡和反向代理的配置与优化.pdf 第7章 Nginx的Rewrite...
整理的nginx的初始化配置文件,做了部分优化,安装nginx后可以直接替换使用。有问题可以直接留言
Nginx 配置说明文档,方便管理和配置,在测试工作中很重要,可以优化测试,达到最优配置策略,方便管理,方便运营,方便配置安装。
nginx与fastcgi优化相关配置,搭建高性能服务器。
超详细的nginx配置教程 nginx作为服务器必备软件,其配置较为复杂,特组织该教程 内容包括: nginx性能优化 大并发 均衡负载 代理模式 限流 动静分享 长连接 文件压缩传输 配置状态监控 数据库 配置nginx支持长连接
Nginx配置优化手册 1. Nginx优化配置 1 1.1 进程数配置优化 1 1.2 事件模型优化 1 1.3 连接数优化 1 1.4 进程最大打开文件数优化 2 1.5 文件传输优化 2 1.6 超时时间配置 2 1.7 开启GZIP压缩 3 1.8 配置日志异步写入...
nginx配置优化+负载均衡+动静分离详解
nginx配置优化+负载均衡+动静分离详解
- 优化Nginx配置文件 - 更改目录.default为a.default,解决特定情况无法读取目录的问题 2012年04月05日 - 解决MySQL远程访问慢的问题 2012年03月30日 - 更新Nginx版本为1.0.14 2012年03月20日 - 优化PHP配置 - ...
nginx基础和优化配置,中小型NGINX的搭建,安全,性能提升等方面的解决方案。
第3章 Nginx的基本配置与优化 第4章 Nginx与PHP(FastCGI)的安装、配置与优化 第5章 Nginx与JSP、ASP.NET、Perl的安装与配置 第6章 Nginx HTTP负载均衡和反向代理的配置与优化 第7章 Nginx的Rewrite规则与实例 第8章 ...
Nginx的基本配置与优化,Nginx的基本配置与优化
大多数的Nginx安装指南告诉你如下基础知识——通过apt-get安装,修改这里或那里的几行配置,好了,你已经有了一个Web服务器了!而且,在大多数情况下,一个常规安装的nginx对你的网站来说已经能很好地工作了。然而,...
nginx配置优化+负载均衡+动静分离详解 每个请求按照ip的hash结果分配,同一个ip的访客固定访问一个后端服务器,可解决动态网页session共享问题
Nginx+FastCGI运行原理 Nginx不支持对外部程序的直接调用或者解析,所有的外部程序(包括PHP)必须通过FastCGI接口来调用。FastCGI接口在Linux下是socket,(这个socket可以是文件socket,也可以是ip socket)。为了...
Nginx常用配置、负载均衡及优化
一、这里的优化主要是指对nginx的配置优化,一般来说nginx配置文件中对优化比较有作用的主要有以下几项: 1)nginx进程数,建议按照cpu数目来指定,一般跟cpu核数相同或为它的倍数。 worker_processes 8; 2)为每...