Nginx Proxy multiple Tomcat caches

Source: Internet
Author: User



User ftp;
Worker_processes 2;




Worker_rlimit_nofile 1024;
Events {
Use Epoll;
Worker_connections 1024;
}




HTTP {
Include Mime.types;
Default_type Application/octet-stream;


Include proxy.conf;
Log_format yundns_log ' $server _name $remote _addr [$time _local] "$request" $status $body _bytes_sent "$http _referer" "$ Http_user_agent "';
#log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '
# ' $status $body _bytes_sent ' $http _referer '
# ' "$http _user_agent" "$http _x_forwarded_for" ';


#access_log Logs/access.log Main;


Server_tokens off;
Sendfile on;
Tcp_nopush on;
Server_names_hash_bucket_size 256;
Client_header_buffer_size 256k;
#large_client_header_buffers 4 32k;


Large_client_header_buffers 4 256k;
Client_body_buffer_size 256k;
Client_header_timeout 3m;
Client_body_timeout 3m;
Send_timeout 3m;


Client_max_body_size 50m;
Keepalive_timeout 120;
Fastcgi_intercept_errors on;
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
#fastcgi_buffer_size 64k;
#fastcgi_buffers 8 64k;
#fastcgi_busy_buffers_size 128k;
#fastcgi_temp_file_write_size 128k;


Fastcgi_buffer_size 128k;
Fastcgi_buffers 4 256k;
Fastcgi_busy_buffers_size 256k;
Fastcgi_temp_file_write_size 256k;

# #cache # #
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;
Proxy_temp_path/home/temp_dir;
Proxy_cache_path/home/cache levels=1:2 keys_zone=cache_one:200m inactive=1d max_size=30g;
# #end # #






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;


server {
Listen 81;


Location/{
root/mnt;
Index index.html index.htm;
Client_body_buffer_size 128k;
}
}



server {
Listen 82;
server_name localhost;
Index index.jsp index.html;
ROOT/MNT/WPH;
Location ~. *\. (gif|jpg|png|htm|html|css|js|flv|ico|swf) (.*) {
Proxy_pass http://localhost:8080;
Proxy_redirect off;
Proxy_set_header Host $host;
Proxy_cache Cache_one;
Proxy_cache_valid 302 1h;
Proxy_cache_valid 301 1d;
Proxy_cache_valid any 1m;
Expires 30d;
}
Location/{
Proxy_pass http://localhost:8080;
Proxy_set_header X-real-ip $remote _addr;
}
}







server {
Listen default_server;
server_name localhost;


Index index.jsp index.html;
Root/mnt/default;
Location ~. *\. (gif|jpg|png|htm|html|css|js|flv|ico|swf) (.*) {
Proxy_pass http://localhost:9000;
Proxy_redirect off;
Proxy_set_header Host $host;
Proxy_cache Cache_one;
Proxy_cache_valid 302 1h;
Proxy_cache_valid 301 1d;
Proxy_cache_valid any 1m;
Expires 30d;
}
Location ~. * {
Proxy_pass http://127.0.0.1:9000;
Proxy_set_header X-real-ip $remote _addr;
}
#location/{
# root HTML;
# index index.html index.htm;
#}


#error_page 404/404.html;


# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}


# Proxy The PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# Proxy_pass http://127.0.0.1;
#}


# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root HTML;
# Fastcgi_pass 127.0.0.1:9000;
# Fastcgi_index index.php;
# Fastcgi_param Script_filename/scripts$fastcgi_script_name;
# include Fastcgi_params;
#}


# Deny access to. htaccess files, if Apache ' s document Root
# concurs with Nginx ' s one
#
#location ~/\.ht {
# Deny All;
#}
}
}

Nginx Proxy multiple Tomcat caches

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.