웹 응용 프로그램의 부하를 nginx를 통해 균형을 잡으려고하고 있습니다. 웹 응용 프로그램이 하위 경로로 서비스를 호출 할 때마다 정상적으로 작동합니다.NGINX에 대한 응답 없음 업스트림을 사용할 때
예를 들어이
http://example.com/luna/
하지만 작동하지
http://example.com/luna/sales
내 nginx.conf에 대한
내 웹 응용 프로그램은/루나/판매 등의 추가 서브 패스와 서비스를 호출user nobody;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream lunaups {
server myhostserver1.com:8080;
server myhostserver2.com:8080;
}
server {
listen 80;
server_name example.com;
proxy_pass_header Server;
location =/{
rewrite^http://example.com/luna redirect;
}
location /luna {
rewrite ^$/luna/(.*)/^ /$1 redirect;
proxy_pass http://lunaups;
#add_header X-Upstream $upstream_addr;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
응답을 반환하지 않습니다. 내가 여기서 무엇을 놓치고 있니?
업스트림에서 내 호스트 서버 중 하나를 제거하면 작동하지만 업스트림에 두 번째 호스트를 추가하면 응답이 반환되지 않습니다.
다시 쓰기 규칙이 잘못되었거나 전체 구성이 잘못 되었습니까?
무엇을'^ $/luna /(.*)/^ '라고해야할까요? 그것은 가짜'$'와 허위'^'를 가진 것 같습니다. –
안녕하세요 리차드, 난 nginx에 새로운이야, 나 자신이 문서를보고 건설, 그냥 시행 착오를 시도하십시오 제발 가능한 경우 수정하십시오. –
URI의'/ luna' 접두어를 업스트림으로 보내기 전에 그 접두어를 없애기로되어 있습니까? –