English 中文(简体)
nginx behaved differently for different version
原标题:
  • 时间:2023-05-23 02:56:14
  •  标签:
  • nginx

I have used docker image nginx:1.18.0-alpine previously

and below is the conf. It works as expected

app.localhost --> points to the block wit server_name app.*

localhost --> points to the other block

irrepective of their order

upstream webapp {
    server webapp:8000;
}

server {
    listen 80;

    server_name app.*;

    #access_log /var/log/nginx/app.access.log;
    #error_log /var/log/nginx/app.error.log;


    location / {
        proxy_pass http://webapp;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        # https://serverfault.com/a/993559
        proxy_read_timeout 1800;
        proxy_connect_timeout 1800;
        proxy_send_timeout 1800;
        send_timeout 1800;
    }
}

server {
   listen 80;

   #access_log /var/log/nginx/normal.access.log;
   #error_log /var/log/nginx/normal.error.log;

    #server_name unicornpost.com;
    root   /usr/share/nginx/html;
    index index.html;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    error_page 404 /404.html;
}

where as nginx/1.23.4 with the same above configuration

localhost or app.localhost always points to the first server block irrepective of server_name app.* or no server_name `

问题回答

暂无回答




相关问题
nginx behaved differently for different version

I have used docker image nginx:1.18.0-alpine previously and below is the conf. It works as expected app.localhost --> points to the block wit server_name app.* localhost --> points to the other ...

What s limiting my PHP resources?

I m having a problem getting more memory out of PHP. This is the error message: Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 82 bytes) in ... Yet: I ve set ...

what user I should run my nginx or php-fpm processes

Ok. Im little bit confused about those permissions in linux so please people help me out. The trouble is that I dont want to run server as root, so I created another user with sudo privileges so he ...

Nginx 301 redirect inc. set cookie

what I m looking for is the ability for nginx to detect that a url has the query string variable cid. for example www.adomain.com/froggy?cid=12&as=false (query string can be solo or mixed with ...

Nginx raises 404 when using format => js

I upload images to my App using Ajax and an Iframe. In Development everything works like a charm. But in production Nginx suddenly raises a 404 error. When I look into the log, the request never hits ...

nginx errors readv() and recv() failed

I use nginx along with fastcgi. I see a lot of the following errors in the error logs readv() failed (104: Connection reset by peer) while reading upstream and recv() failed (104: Connection ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

热门标签