# tar zxvf nginx-upstream-jvm-route-0.1.tar.gz -C /usr/src/
Beachten Sie, dass dies in denselben Ordner extrahiert wird. Der Standardname lautet hier nginx-1.0.13
# cd /usr/nginx-1.0.13/
# patch -p0 < /usr/nginx-1.0.13/nginx_upstream_jvm_route/jvm_route.patch
(3), installiere nginx: # ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre=/usr/src/pcre-8.30 --add-module=/usr/src/ nginx_upstream_jvm_route - -with-openssl=/usr/ (
--user= --group=)# make && make install
(4), nginx.conf bearbeiten:
# vi /usr/local/nginx/conf/nginx .conf
Benutzer niemand;worker_processes 8;error_log logs/nginx_error.log crit;pid /usr /local/nginx/nginx.pid;#Gibt den Wert für maximale Dateideskriptoren an, die von diesem Prozess geöffnet werden können.worker_rlimit_nofile 20480;events { use epoll; worker_connections 20480;} http { Upstream-AA { Server 127.0.0.1:8080 max_fails=3 fail_timeout=50s; } Upstream BB { Server 127.0.0.1:8081 max_fails=3 fail_timeout=50s; } include mime.types; default_type application/octet-stream; #charset gb2312; charset UTF-8; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_header_timeout 20; client_max_body_size 20m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; proxy_connect_timeout 30; proxy_read_timeout 60; Proxy_send_timeout 20; proxy_buffer_size 96k; proxy_buffers 8 256k; proxy_busy_buffers_size 512k; proxy_temp_file_write_size 512k;# Proxy_store on; # Proxy_store_access user:rw group:rw all:rw; proxy_temp_path /usr/local/nginx/proxy_temp;proxy_cache_path /usr/local/nginx/www Ebenen =1:2 keys_z inactive=1d max_size=2g; gzip on; gzip_proxied any; 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;# limit_zone one $binary_remote_addr 10m; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header 🎜> server_name 192.168.3.30; index index.html;# ^/index.html umschreiben / last;#rewrite ^/(.*)_p([0-9]*)_(.*)_e(.*)/(.*)_(.*)_t( .*)_o(.*)_(l|s|k|[0-9]*)$ /searchclassbigkey?skey=$1&pno=$2&sw=$3&pe=$4&rk=$5&dekey=$6&tid= $7&ocs=$8&ocid=$9 last;#rewrite ^/(.*)_p([0-9]*)_s(.*)/(.*)_(.*) _(.*)$ /searchkey?skey=$1&pno=$2&sw=$3&pe=$4&rk=$5&dekey=$6 last;# rewrite ^/d-(.*)$ / detaillist?id=$1 last; Standort / {# Proxy_next_upstream http_502 http_504 error timeout invalid_header;# Proxy_headers_hash_max_size 1024;# 128;# Proxy_cache Cache_One; 🎜> Proxy_cache_key $host$uri$is_args$args;# Proxy_set_header http://aa; } Standort ~ .*.(gif|jpg|jpeg|png|bmp| swf)$ {# Proxy_cache Cache_one; Proxy_cache_valid 200 304 5h;> 🎜> Proxy_pass http://aa; } Standort ~ .*.(js|css|html)$ {# Proxy_cache Cache_one; Proxy_cache_valid 200 304 3 Stunden; 🎜> läuft ab 5h; Proxy_pass http://aa;} log_format aa '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; access_log /usr/local/nginx/logs/aa.log aa; } server { listen 80; server_name 192.168.3.31; index index.html; location / { Proxy_cache Cache_One; Proxy_cache_key $host$uri$is_args$args; Proxy_pass http://bb; } Standort ~ .*.(gif|jpg|jpeg|png|bmp|swf|js|css|html)$ { Proxy_cache Cache_One; Proxy_cache_valid 200 304 5 Stunden; 3m; läuft ab 8h; Proxy_cache_key $host$uri$is_args$args; Proxy_pass http://bb; }log_format bb '$remote_addr - $remote_user [$time_local] "$request" ' '$ status $ body_bytes_sent "$ http_referer"' '"$ http_user_agent" $ http_x_forded_for'; local/nginx/logs/bb.log bb; } } # /usr/local/nginx/sbin/nginx -tnginx: Die Syntax der Konfigurationsdatei /usr/local/nginx/conf/nginx.conf ist in Ordnungnginx: Konfigurationsdatei /usr /local/nginx/conf/nginx.conf-Test ist erfolgreich # /usr/local/nginx/sbin/nginx# netstat -anpt | grep 80