I very appreciated if someone can give me some help. I just tried to learn the nginx reverse proxy but have experienced some problem about upstream name syntax.
Please refer to this photo Photo: nginx reverse proxy server structure
When I curl 192.168.189.140, the proxy server shows
[debug] vhost.c(811): [client 192.168.189.140] [strict] Invalid host name 'bbs_server_pools', problem near: _serve
[debug] vhost.c(902): [client 192.168.189.140] Client sent malformed Host header: bbs_server_pools
After I changed upstream name bbs_server_pools to bbs, it works all good. Is this something to do with the version of nginx or something else?
error Nginx.conf file
worker_processes 1; error_log logs/error.log error; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; log_format main '$remote_addr - $remote_user [$time_local] "$request"' '$status $body_bytes_sent "$http_referer"' '"$http_user_agent" "$http_x_forwarded_for"'; server { listen 80; server_name bbs.etiantian.org; location / { proxy_pass http://bbs_server_pools; } } upstream bbs_server_pools { server 192.168.189.137:80; server 192.168.189.138:80 weight=3; } }
good nginx.conf file after changing bbs_server_pools to bbs
worker_processes 1; error_log logs/error.log error; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; log_format main '$remote_addr - $remote_user [$time_local] "$request"' '$status $body_bytes_sent "$http_referer"' '"$http_user_agent" "$http_x_forwarded_for"'; server { listen 80; server_name bbs.etiantian.org; location / { proxy_pass http://bbs; } } upstream bbs { server 192.168.189.137:80; server 192.168.189.138:80 weight=3; } }