Nginx reverse proxy, there is a problem with the configuration, it has been unsuccessful.

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:
clipboard.png

80nginxlocation /elasticsearch/rewritelocation / :
clipboard.png

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.

Jun.15,2022

give you a URL this method of configuring nginx can be successful at once. Follow the steps and you can http://www.cygdream.com/blog


how can you represent this two or three times? ?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b372dd-2c089.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b372dd-2c089.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?