03.Nginx配置

user  www www;

worker_processes 4;

worker_cpu_affinity 0001 0010 0100 1000;

error_log  /data1/logs/nginx-1.7.4/error.log debug_http;

pid /data/program/nginx-1.7.4/logs/nginx.pid;

worker_rlimit_nofile 204800;

events {

use epoll;

worker_connections 20480;

multi_accept on;

accept_mutex off;

}

http {

include       mime.types;

default_type  application/octet-stream;

log_format  access  ‘$http_x_forwarded_for $remote_addr [$time_local] "$request" ‘

‘$status $body_bytes_sent "$http_referer" ‘

‘"$http_user_agent"‘;

sendfile        on;

tcp_nodelay     on;

tcp_nopush     on;

server_tokens off;     #关闭版本显示

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 256k;

fastcgi_buffers 16 256k;

fastcgi_busy_buffers_size 512k;

fastcgi_temp_file_write_size 512k;

#设定请求缓冲

server_names_hash_bucket_size 128;

client_body_buffer_size  128K;

client_header_buffer_size    16k;

large_client_header_buffers  4 64k;

client_max_body_size 1G;

client_body_timeout   30;

client_header_timeout 10;

keepalive_timeout     65;

send_timeout          30;

reset_timedout_connection on;

proxy_connect_timeout   110;

proxy_send_timeout      110;

proxy_read_timeout      110;

proxy_buffer_size       128k;

proxy_buffers           4 256k;

proxy_busy_buffers_size 256k;

proxy_temp_file_write_size 64m;

proxy_ignore_client_abort on;

open_file_cache max=204800 inactive=20s;

open_file_cache_min_uses 1;

open_file_cache_valid 30s;

#开启gzip模块

gzip on;

gzip_min_length  1k;

gzip_http_version 1.1;

gzip_buffers     8 32k;

gzip_comp_level 2; #0-9 默认值为1,值越大压缩率越高,消耗的cpu资源越多,传输量减小

gzip_types     text/css application/x-javascript ;

gzip_vary on;

#gzip_static on;

gzip_proxied        any;

gzip_disable    "MSIE [1-6]\.";

output_buffers   1 32k;

postpone_output  1460;

server {

listen       80 default_server;

access_log   off;

server_name   _;   #default

return 444;

}

#server {

# listen       6428;

# access_log   off;

#

# location / {

# index  index.html;

# root /data/wwwroot/slb;

# expires      30d;

# }

#

# error_page   500 502 503 504  /50x.html;

# location = /50x.html {

# root   html;

# }

# }

#

include  site/*.conf;

}

server {

listen          80;

server_name    store-admin-test.nubia.cn;

access_log     /tmp/ddd;

location / {

proxy_pass http://localhost:8007;

proxy_http_version 1.1;

proxy_set_header Connection "";

proxy_redirect  off;

proxy_set_header Accept-Encoding ‘gzip‘;

proxy_set_header Host            $http_host;

proxy_set_header X-Real-IP     $proxy_add_x_forwarded_for;

#$http_x_forwarded_for;

#$remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header   Cookie   $http_cookie;

#chunked_transfer_encoding off;

}

location ~ ^/(WEB-INF)/ {

deny all;

}

error_page 403 404 500 502 503 504  /error.html;

}

时间: 2024-08-07 04:15:55

03.Nginx配置的相关文章

一些NGINX配置

一些nginx配置 使用独立目录, 然后include具体配置 gzip on for multi processers static file cache proxy pass 静态目录 or 文件 静态站 return for mobile redirect to www allow and deny 负载均衡 centos service cmds nginx配置 开年第一篇, 梳理笔记本中.... 没啥, 一些用到以及后面可能用到的nginx配置, 记录一下, 备查备用 ps. 之前一篇

FastDFS5.03安装配置

FastDFS介绍 fastdfs是一个开源的,高性能的的分布式文件系统,他主要的功能包括:文件存储,同步和访问,设计基于高可用和负载均衡,fastfd非常适用于基于文件服务的站点,例如图片分享和视频分享网站.    fastfds有两个角色:跟踪服务(tracker)和存储服务(storage),跟踪服务控制,调度文件以负载均衡的方式访问:存储服务包括:文件存储,文件同步,提供文件访问接口,同时以key value的方式管理文件的元数据.    跟踪和存储服务可以由1台或者多台服务器组成,同时

nginx配置进阶(三)

nginx配置进阶(三) ======================================================================================= 概述: ======================================================================================= ngx_http_fastcgi_module模块:构建lnmp  1.The ngx_http_fastcgi_

Nginx配置站点适配PC和手机

考虑到站点的在多种设备下的兼容性,有非常多站点会有手机版和电脑版两个版本号.訪问同一个站点URL,当服务端识别出用户使用电脑訪问.就打开电脑版的页面,用户假设使用手机訪问,则会得到手机版的页面. 1.推断client的设备类型 要想让站点适配PC和手机设备,首先要能做出准确的推断.HTTP请求的Header中的User-Agent能够区分client的浏览器类型.能够通过User-Agent来推断client的设备. 不管是PC还是手机,因为操作系统.浏览器的多样性,自己来实现这个推断并不eas

Nginx配置网站适配PC和手机

考虑到网站的在多种设备下的兼容性,有很多网站会有手机版和电脑版两个版本.访问同一个网站URL,当服务端识别出用户使用电脑访问,就打开电脑版的页面,用户如果使用手机访问,则会得到手机版的页面. 1.判断客户端的设备类型 要想让网站适配PC和手机设备,首先要能做出准确的判断.HTTP请求的Header中的User-Agent可以区分客户端的浏览器类型,可以通过User-Agent来判断客户端的设备. 无论是PC还是手机,由于操作系统.浏览器的多样性,自己来实现这个判断并不容易.好在国外有一套开源的通

CentOS7.1下生产环境Keepalived+Nginx配置

注:下文涉及到配置的,如无特别说明,主备机则一致! 一.环境介绍 1.这是我CentOS的版本,CentOS7.1,主备都为该版本 [[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [[email protected] ~]# cat /proc/version Linux version 3.10.0-229.el7.x86_64 ([email protected]) (gc

Nginx负载均衡、ssl原理、生成ssl密钥对、Nginx配置ssl

Nginx负载均衡 Nginx负载均衡即为当代理服务器将自定义的域名解析到多个指定IP时,通过upstream来保证用户可以通过代理服务器正常访问各个IP. 代理一台机器叫做代理,代理两台及两台服务器就能叫做负载均衡. 负载均衡配置 创建一个配置文件/usr/local/nginx/conf/vhost/load.con [[email protected] ~]# vim /usr/local/nginx/conf/vhost/load.conf upstream qq.com #借助upst

linux学习笔记——搭建基于nginx的web服务器、多核配置、nginx配置参数

############ 认识nginx #############Nginx:(发音同 engine x)是一款轻量级的Web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个BSD-like 协议下发行.由俄罗斯的程序设计师Igor Sysoev所开发,最初供俄国大型的入口网站及搜寻引擎Rambler(俄文:Рамблер)使用.  其优点是轻量级(占有内存少),高并发(并发能力强),事实上nginx的并发能力确实在同类型的网页伺服器中表现较好.目前中国大陆使用ngi

12.17 Nginx负载均衡;12.18 ssl原理;12.19 生产ssl密钥对;12.20 Nginx配置ssl

扩展: 针对请求的uri来代理 http://ask.apelearn.com/question/1049 根据访问的目录来区分后端web http://ask.apelearn.com/question/920 12.17 Nginx负载均衡 1. 安装dig命令: [[email protected] ~]# yum install -y bind-utils 2. 用dig获取qq.com的ip地址: [[email protected] ~]# dig qq.com 3. 创建ld.co