This note is about the problems that I met while using Web Server.
Apache Http Server
mod_proxy vs. mod_jk
mod_proxy
- Pros:
- No need for a separate module compilation and maintenance. mod_proxy, mod_proxy_http, mod_proxy_ajp and mod_proxy_balancer comes as part of standard Apache 2.2+ distribution
- Ability to use http https or AJP protocols, even within the same balancer.
- Cons:
- mod_proxy_ajp does not support large 8K+ packet sizes.
- Basic load balancer
- Does not support Domain model clustering
mod_jk
- Pros:
- Advanced load balancer
- Advanced node failure detection
- Support for large AJP packet sizes
- Cons:
- Need to build and maintain a separate module
Tomcat Server
Nginx Server
CORS
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-C
ontrol,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache
-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
proxy_redirect off;
proxy_set_header host $host;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-forward-for $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
Limit
http {
limit_conn_zone $binary_remote_addr zone=one:10m;
}
server{
location {
limit_conn one 20;
limit_rate 500k;
}
}
竟然无法拒绝你的打赏