user nginx nginx;worker_processes 8;worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 0010000 01000000 10000000;error_log /data /logs/nginx_error.log crit;pid /var/run//nginx.pid;worker_ rlimit_nofile 65535; #这个指令是指当一个nginx Process Open the maximum number of file descriptors, the theoretical value should be the maximum number of open files (ulimit  -N) divides the number of nginx processes, but nginx allocation requests are not uniform, so it is best to keep the values of ulimit -n consistent. i/o model of events { use epoll; #使用epoll worker_connections 65535; #每个进程允许的最多连接数, theoretically each nginx The maximum number of connections for the server is worker_processes*worker_connections. }http { include mime.types; default_type application/octet-stream; charset utf8; server_names_hash_bucket_size 128; client_header_buffer_size 32k; #客户端请求头部的缓冲区大小, this can be set according to your system paging size, generally a request header size will not exceed 1k, but because the general system paging is greater than 1k, so this is set to paging size. The paging size can be obtained with the command getconf pagesize . large_client_header_buffers 4 32k; client_max_body_ size 300m; #open_file_cache max=102400 inactive=20s; # This will specify the cache for the open file, the default is not enabled,max specifies the number of caches, the recommended and open files are consistent,inactive is the amount of time after the file has not been requested to delete the cache. #open_file_cache_valid 30s; #这个是指多长时间检查一次缓存的有效信息. #open_file_cache_min_uses 1; #open_file_cache The minimum number of times the file is used in the inactive parameter time in the instruction, if it exceeds this number, the file descriptor is always opened in the cache, as in the example above, if a file is not used once in inactive time, it will be removed. sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; client_body_buffer_size 512k; ### #下面这段要添加上去的 proxy_connect_timeout 5; proxy_ read_timeout 60; proxy_send_timeout 5; proxy_buffer_size 16k; proxy_ Buffers 4 64k; proxy_busy_ buffers_size 128k; proxy_temp_file_write_size 128k; server_tokens off; #对网页文件, CSS, JS, XML, such as start gzip compression, reduce the amount of data transmission, improve access speed. gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/ x-javascript text/css application/xml; gzip_vary on; # Disable Access #server { #server_name through ip _; #return 404; #} server { listen 80; server_name xx.com yy.com; index index.html index.htm index.jsp index.do default.do default.jsp; root /data/app_web; location ~ ^/appstore/ { Rewrite ^/appstore/(. *) $ /$1 break; index index.jsp proxy_set_header host $host; proxy_set_header X-Forward-For $remote _addr; proxy_pass http://127.0.0.1:8081; } location ~ ^/tvinfo/ { rewrite ^/tvinfo/(. * ) $ /$1 break; index index.jsp proxy_set_header Host $host; proxy_set_header  x-forward-for $remote _addr; proxy_pass http:// 127.0.0.1:8082; } location / { rewrite /(. *) $ /$1 break; index index.jsp; proxy_set_header Host $host; proxy_set_header X-Forward-For $remote _addr; proxy_pass http://127.0.0.1:8089; } #定义访问日志的写入格式 log_format access ' $ remote_addr - $remote _user [$time _local] "$request" " ' $ status $body _bytes_sent "$http _referer" ' "$http _user_agent" $http _x_forwarded_for '; access_log /data/logs/access.log access; }
This article is from the "My Ops Road" blog, so be sure to keep this source http://linuxpython.blog.51cto.com/10015972/1630582
Nginx Proxy Local Tomcat instance configuration file