May 31, 2020 - 22:17:11
Django version 1.11.9, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:9000/
Quit the server with CONTROL-C.
[31/May/2020 22:17:21] "GET /test111/ HTTP/1.0" 200 16
192.168.137.1 - - [01/Jun/2020:06:17:21 +0800] "GET /test111/ HTTP/1.1" 200 16 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
events
{
use epoll;
worker_connections 65535;
multi_accept on;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
client_max_body_size 128m;
client_body_buffer_size 16m;
fastcgi_buffer_size 256k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
proxy_buffering on;
proxy_buffer_size 1024k;
proxy_buffers 32 8192k;
proxy_busy_buffers_size 16384k;
sendfile on;
tcp_nopush on;
keepalive_timeout 120s;
keepalive_requests 30000;
reset_timedout_connection on;
client_body_timeout 3m;
tcp_nodelay on;
gzip on;
gzip_min_length 16k;
gzip_buffers 8 32k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6].";
server_tokens off;
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 off;
upstream backend1 {
server 192.168.137.3:9000 weight=5;
}
upstream backend2 {
server 192.168.137.3:80 weight=5;
}
##upstream backend 位置放错了, upstream位置应该放在http模块里面 但必须是在server模块的外面
server
{
listen 8090 default_server backlog=1024;
#server_name paytest.zjtlcb.com;
index index.html index.htm;
#root /app/weblogic/html/;
#root /app_nas/apps/deploy/html/;
location /nginx_status {
stub_status on;
access_log off;
allow 1.2.101.1;
allow 1.2.101.2;
allow 1.2.101.3;
allow 1.2.101.4;
allow 1.2.101.5;
allow 1.2.101.6;
allow 1.2.101.7;
allow 1.2.101.8;
deny all;
}
location ^~ /
{
proxy_pass http://backend1/;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
}
}
#include vhost/*.conf;
}
查找顺序和优先级
1:带有“=“的精确匹配优先
2:没有修饰符的精确匹配
3:正则表达式按照他们在配置文件中定义的顺序
4:带有“^~”修饰符的,开头匹配
5:带有“~” 或“~*” 修饰符的,如果正则表达式与URI匹配
6:没有修饰符的,如果指定字符串与URI开头匹配
Location区段匹配示例location = / {
# 只匹配 / 的查询.
[ configuration A ]
}
location / {
# 匹配任何以 / 开始的查询,但是正则表达式与一些较长的字符串将被首先匹配。
[ configuration B ]
}
location ^~ /images/ {
# 匹配任何以 /images/ 开始的查询并且停止搜索,不检查正则表达式。
[ configuration C ]
}
location ~* .(gif|jpg|jpeg)$ {
# 匹配任何以gif, jpg, or jpeg结尾的文件,但是所有 /images/ 目录的请求将在Configuration C中处
理。
[ configuration D ]
} 各
请求的处理如下例: