nginx基本配置
#user nobody;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
worker_rlimit_nofile 65535;
events {
use epoll;
worker_connections 10240;
}
http {
include mime.types;
default_type application/octet-stream;
#定义日志格式
log_format main '$remote_addr [$time_local] $request '
'$status $body_bytes_sent $request_time'
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main; #访问日志
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
#gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain application/xml text/html;
gzip_disable "MSIE [1-6] .";
upstream local{
server 127.0.0.1:8080; #监听本地服务端口
server 10.3.18.190:8080; #监听另外一台机器的服务端口,切换可以试用down参数或者注释
}
server {
listen 80; #nginx本地端口
server_name localhost; #本地服务
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
# root html;
# index index.html index.htmi;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy request to resin
location / {
proxy_pass http://local;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #后端服务获取用户真正ip
#允许客户端请求的最大的单个文件字节数
client_max_body_size 10m;
#缓冲区代理缓冲用户端请求的最大字节数 可以理解为先保存到本地再传给用户
client_body_buffer_size 128k;
client_body_temp_path /data/client_body_temp;
#跟后端服务器连接的超时时间_发起握手等候响应超时时间
proxy_connect_timeout 90;
#后端服务器数据回传时间_就是在规定时间之内后端服务器必须传完所有的数据
proxy_send_timeout 90;
#连接成功后_等候后端服务器响应时间_其实已经进入后端的排队之中等候处理
proxy_read_timeout 90;
#代理请求缓存区_这个缓存区间会保存用户的头信息以供Nginx进行规则处理_一般只要能保存下头信息即可
proxy_buffer_size 4k;
proxy_buffers 4 32k; #同上 告诉Nginx保存单个用的几个Buffer 最大用多大空间
proxy_busy_buffers_size 64k; #如果系统很忙的时候可以申请更大的proxy_buffers 官方推荐*2
proxy_temp_file_write_size 64k; #proxy缓存临时文件的大小
proxy_temp_path /data/proxy_temp;
}
location /nginx-profiler {
stub_status on;
access_log on;
auth_basic "NginxStatus";
}
}
}
Stumbled into this site by chance but I’m sure glad I clicked on that link. You definitely answered all the questions I’ve been dying to answer for some time now. Will definitely come back for more of this. Thank you so much
近期刚开始学习搭建博客,不经意通过google找到了www.fhand.com,特别钟意您blog的风格,看了您的佳作感觉受益良多,您的美文十分实用。也非常容易领会。掐指算算这篇应该是兄弟在您blog上偷学的第4招了!开心:)再接再厉哦!衷心期盼您的网站越办越好。
Are you currently keen on content trade? I experienced number of similar weblogs but I closed them. Income was very low.