25,985
社区成员
发帖
与我相关
我的任务
分享
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.test.net;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://192.168.1.8;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name blog.test.net;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://192.168.1.8/blog/;
# proxy_redirect http://192.168.1.8/blog/ http://192.168.1.8/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name bbs.test.net;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_pass http://192.168.1.8:8888/bbs2/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
代理前
[2018-07-13T20:30:58+08:00] 192.168.0.1 192.168.0.140 "GET /?a=b HTTP/1.1" 404 162 "-" "curl/7.29.0" "-" "192.168.0.140:7777" "0.000" 0.000
[2018-07-13T20:31:24+08:00] 192.168.0.1 192.168.0.140 "GET /dir1/dir2/file?a=b HTTP/1.1" 404 162 "-" "curl/7.29.0" "-" "192.168.0.140:7777" "0.001" 0.001
[2018-07-13T20:31:33+08:00] 192.168.0.1 192.168.0.140 "GET /dir1/file?a=b HTTP/1.1" 404 162 "-" "curl/7.29.0" "-" "192.168.0.140:7777" "0.000" 0.000
[2018-07-13T20:31:40+08:00] 192.168.0.1 192.168.0.140 "GET /file?a=b HTTP/1.1" 404 162 "-" "curl/7.29.0" "-" "192.168.0.140:7777" "0.001" 0.001
[2018-07-13T20:31:43+08:00] 192.168.0.1 192.168.0.140 "GET / HTTP/1.1" 404 162 "-" "curl/7.29.0" "-" "192.168.0.140:7777" "0.000" 0.000
[2018-07-13T20:33:04+08:00] 192.168.0.1 192.168.0.140 "GET /?a=b HTTP/1.1" 404 162 "-" "curl/7.29.0" "-" "192.168.0.140:7777" "0.000" 0.000
代理后
[2018-07-13T20:30:58+08:00] 192.168.0.140 192.168.0.140 "GET /blog/?a=b HTTP/1.0" 404 162 "-" "curl/7.29.0" "192.168.0.1" "-" "-" 0.001
[2018-07-13T20:31:24+08:00] 192.168.0.140 192.168.0.140 "GET /blog/dir1/dir2/file?a=b HTTP/1.0" 404 162 "-" "curl/7.29.0" "192.168.0.1" "-" "-" 0.000
[2018-07-13T20:31:33+08:00] 192.168.0.140 192.168.0.140 "GET /blog/dir1/file?a=b HTTP/1.0" 404 162 "-" "curl/7.29.0" "192.168.0.1" "-" "-" 0.000
[2018-07-13T20:31:40+08:00] 192.168.0.140 192.168.0.140 "GET /blog/file?a=b HTTP/1.0" 404 162 "-" "curl/7.29.0" "192.168.0.1" "-" "-" 0.000
[2018-07-13T20:31:43+08:00] 192.168.0.140 192.168.0.140 "GET /blog/ HTTP/1.0" 404 162 "-" "curl/7.29.0" "192.168.0.1" "-" "-" 0.000
[2018-07-13T20:33:04+08:00] 192.168.0.140 192.168.0.140 "GET /blog/?a=b HTTP/1.0" 404 162 "-" "curl/7.29.0" "192.168.0.1" "-" "-" 0.000