Web Server Note

Reading time ~1 minute

This note is about the problems that I met while using Web Server.

Apache Http Server

mod_proxy vs. mod_jk

mod_proxy

  1. Pros:
    1. 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
    2. Ability to use http https or AJP protocols, even within the same balancer.
  2. Cons:
    1. mod_proxy_ajp does not support large 8K+ packet sizes.
    2. Basic load balancer
    3. Does not support Domain model clustering

mod_jk

  1. Pros:
    1. Advanced load balancer
    2. Advanced node failure detection
    3. Support for large AJP packet sizes
  2. Cons:
    1. 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;
    }
  }

竟然无法拒绝你的打赏

微信支付

专业处理中国护照照片一次通过

专业处理中国护照照片一次通过 Continue reading

Python Notes

Published on April 01, 2021

Scrum Training Notes

Published on December 01, 2020