there is a system on the virtual with port number 9200.
now I don"t want to go directly to this port. I want to access it through port 80 that nginx listens to.
but location doesn"t seem to match all the time. Thank you for your advice.
nginx.conf
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.line.com;
location / {
root html;
index index.html index.htm;
}
-sharp 9200rewrite9200
location /elasticsearch/ {
rewrite ^/elasticsearch/(.*) /$1;
proxy_pass http://127.0.0.1:9200;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
-sharp es
server {
listen 9001;
server_name www.line.com;
location / {
proxy_pass http://127.0.0.1:9200/;
}
}
}
access via port, the result is normal:
80nginxlocation /elasticsearch/rewritelocation / :
it is OK to listen directly to a port 9001 and then proxy all requests on that port to 9200.
but now I just want to match and forward by address.
would you please tell me where the problem is and how to change it.