- 浏览: 851721 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
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 1756fs.file-max=51200 net.core.net ... -
top的替代工具
2011-06-28 15:06 1472dstat -cgilpymn collectl and ... -
有用的小工具
2010-12-23 11:51 1351pv stream nessus Nikto ski ... -
调优linux i/o 行为
2010-11-25 11:27 2920http://www.westnet.com/~gsmith/ ... -
服务器部署工具
2010-11-12 16:32 2062http://www.linuxlinks.com/artic ... -
开源的配置管理工具
2010-11-12 16:24 1474最佳开源配置管理工具: Puppet / 提名:OpenQ ... -
优化ext3的mount选项
2010-11-12 10:24 1351defaults,commit=600,noatime,nod ... -
恢复r710biso 出厂设置
2010-11-10 10:30 1224ALT+E/F/B -
每进程io监控工具
2010-11-02 14:14 1662iodump iotop iopp pidstat b ... -
Intel Xeon 5500/5600系列 CPU服务器内存设置
2010-11-01 21:29 4850http://www.xasun.com/article/2a ... -
zabbix短信报警脚本文件
2010-10-21 14:28 2791附件 -
天外飞仙级别的Linux Shell命令
2010-10-16 09:59 1448本文编译自commandlinefu.com ( 应该是 Ca ... -
lenny+r710+lvm 重启问题解决方案
2010-10-15 14:22 1129ro rootdelay=10 quiet -
fai,debian 自动安装工具
2010-10-15 13:36 1118http://sys.firnow.com/linux/x80 ... -
十个服务器监控工具
2010-09-26 11:44 1835一位国外的技术博主在 ... -
restrict authorized_keys
2010-09-06 09:45 1265command="/home/someuser/rs ... -
sysctl优化设置
2010-09-05 11:25 1143sysctl 是一个用来在系统运作中查看及调整系统参数的工 ... -
proc文件系统
2010-09-05 11:22 1259什么是proc文件系统? proc文件系统是一个伪 ... -
nfs使用
2010-09-02 17:01 1156http://www.linuxhomenetworking. ... -
lsof example
2010-08-23 12:40 12741、查看文件系统阻塞 ...
相关推荐
为了提高 Nginx 的并发访问量,我们需要优化 Nginx 的配置文件。例如,我们可以修改 Nginx 的进程数量,调整处理请求数量。我们可以使用以下命令来修改 Nginx 配置文件: ``` [root@proxy nginx-1.12.2]# vim /usr/...
**Nginx配置与优化详解** Nginx是一款高性能的HTTP和反向代理服务器,以其轻量级、高效的性能和高并发处理能力而备受青睐。本文将深入探讨Nginx的配置及其优化策略,帮助你更好地理解和提升Nginx的服务性能。 ### ...
此外,还可以通过调整`worker_processes`、`keepalive_timeout`等参数来优化Nginx配置。 10. **错误页面定制** 你可以自定义404、500等错误页面,提供更好的用户体验。在`server`块中添加`error_page`指令即可: ...
nginx配置多个静态资源 本文将详细介绍nginx配置多个静态资源的知识点,从基本概念到配置实践,涵盖了nginx配置文件的各个组件和指令。 nginx配置文件结构 nginx配置文件主要由以下几个部分组成: * main块:...
第3章 Nginx的基本配置与优化.pdf 第4章 Nginx与PHP(FastCGI)的安装、配置与优化.pdf 第5章 Nginx与JSP、ASP.NET、Perl的安装与配置.pdf 第6章 Nginx HTTP负载均衡和反向代理的配置与优化.pdf 第7章 Nginx的Rewrite...
在IT行业中,项目打包运行和Nginx配置是两个关键环节,它们对于应用程序的部署和发布至关重要。这里我们将深入探讨这两个主题。 首先,项目打包运行通常指的是将开发完成的前端或后端应用转换为可部署的形式。对于...
设置监听地址和端口,与Nginx配置中的`fastcgi_pass`对应: ```ini listen = 127.0.0.1:9000 ``` 启动Nginx和PHP-FPM服务。如果一切配置无误,现在你应该可以通过浏览器访问`http://localhost/`并看到Nginz的欢迎...
3. **编辑Nginx配置文件**:找到Nginx的配置文件,通常是`/etc/nginx/nginx.conf`或`/usr/local/nginx/conf/nginx.conf`。添加一个新的`server`块,配置如下: ```nginx server { listen 80; listen 443 ssl; # ...
当我们面临需要支持百万用户量的场景时,优化Nginx配置至关重要。本文将详细介绍如何配置Nginx来应对大规模用户访问。 1. **理解Nginx的工作原理** Nginx采用事件驱动模型,非阻塞I/O,能够高效地处理大量并发连接...
在本文中,我们将深入探讨如何在Ubuntu操作系统上安装和配置Nginx服务器,这是一个流行的开源Web服务器,以其高性能和稳定性而闻名。...通过不断学习和实践,你可以进一步优化Nginx配置,提升Web应用的性能和可靠性。
在部署 Vue 项目时,Nginx 配置文件 `nginx.conf` 的关键设置如下: 1. **基本配置**: - `server` 块:定义一个监听特定端口(通常是80)的服务器实例。 ```nginx server { listen 80; server_name your...
整理的nginx的初始化配置文件,做了部分优化,安装nginx后可以直接替换使用。有问题可以直接留言
深入理解Nginx配置文件的解析机制,特别是`ngx_http_block`函数及其相关数据结构的作用,对于高效地管理和优化Nginx配置至关重要。通过对HTTP Block、Server Block以及Location Block的组织方式的剖析,我们不仅能够...
Nginx 配置是 Web 服务器中的一种重要配置,需要根据实际情况进行调整和优化。以下是 Nginx 配置步骤详细的知识点总结: 一、worker_processes 配置 * worker_processes 指令指定了 Nginx 的 worker 进程数量,...
在Windows环境下,配置Nginx以支持HTTPS及在同一端口监听多个网站,即配置多个虚拟主机,是一项常见的网络服务设置任务。...同时,根据实际需求,还可以对Nginx配置进行更复杂的优化,如负载均衡、缓存等。
本文将深入探讨“Vue打包部署Nginx配置”的相关知识点。 一、Vue.js项目打包 Vue.js项目在开发完成后,需要通过Webpack进行打包。Webpack是一个模块打包工具,它将各种资源(如JavaScript、CSS、图片等)视为模块...
【Nginx网页配置工具 v2.4.7 源码详解】 Nginx是一款高性能的Web服务器和反向代理服务器,广泛应用于网站部署、负载均衡和静态内容服务等...同时,这也有助于开发者更好地定制和优化Nginx配置,满足特定项目的需求。
**Nginx是一款高性能的HTTP和反向代理服务器,广泛应用于Web服务,具有轻量级、高并发处理能力以及优秀的稳定性。...了解并熟练掌握这些配置,能够帮助我们更好地管理和优化Nginx服务器,提升Web服务性能。
本文将基于“企业级应用Nginx配置案例”这一主题,深入探讨Nginx的配置知识,以帮助你在实际工作中更好地理解和应用。 首先,Nginx配置文件通常位于`/etc/nginx/nginx.conf`,它由多个块组成,如`http`、`server`和...
1. **基础配置**:在Nginx配置文件中,我们需要设置监听端口、日志路径等基本信息。例如: ``` server { listen 80; server_name leyoutest.com; # 替换为你的域名或IP access_log /var/log/nginx/leyou-manage...