Score:0

nginx upstream doesn't seem to be recognized

ba flag

After fresh installation nginx on Amazon Linux 2 (EC2) following commands,

$ amazon-linux-extras install nginx1
$ nginx -v
nginx version: nginx/1.22.0
$ cat /proc/version
Linux version 5.10.144-127.601.amzn2.x86_64 (mockbuild@ip-10-0-44-229) (gcc10-gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1), GNU ld version 2.35-21.amzn2.0.1) #1 SMP Thu Sep 29 01:11:59 UTC 2022

I'm confused about the behavior of upstream directive is not working as my expectation. I just want http://my-domain.com to pass all requests to http://1234-567-89-012-345.ngrok.io and returns results without domain changes.

Starting from the default config file /etc/nginx/nginx.conf, The followings are my tries.

(GET http://1234-567-89-012-345.ngrok.io/ping returns pong as text response)

Try 1

Try 2

  • Modification
    server {
        listen 8081;
        listen [::]:8081;
        server_name devproxy_server;
    
        location / {
            proxy_pass http://1234-567-89-012-345.ngrok.io;
        }
    }
    
  • Expected: Navigate to http://1234-567-89-012-345.ngrok.io/ping on Google Chrome, and show text pong on the page.
  • Actual: It works as I expected. See the screenshot

Am I missing something? Thanks a lot for your answers! :)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.