Score:0

Nginx conflicting server name for reverse proxy

cn flag

I've created a reverse proxy config for my subdomain but when I ran nginx -t it gave warn [warn] conflicting server name "img.somedomain.com" on 0.0.0.0:80, ignored

proxy_cache_path /root/cache-proxy levels=1:2 keys_zone=pximg:10m max_size=10g inactive=7d use_temp_path=off;

server {
    server_name  img.somedomain.com;
    listen 80;
    access_log off;

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    ssl_certificate     /etc/letsencrypt/live/img.somedomain.com/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/img.somedomain.com/key.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/img.somedomain.com/ca.pem;
    ssl_stapling_verify on;

    location / {
        proxy_cache pximg;
        proxy_pass https://i.pximg.net;
        proxy_cache_revalidate on;
        proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
        proxy_cache_lock on;
        add_header X-Cache-Status $upstream_cache_status;
        proxy_set_header Host i.pximg.net;
        proxy_set_header Referer "https://www.pixiv.net/";
        proxy_set_header User-Agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36";

        proxy_cache_valid 200 7d;
        proxy_cache_valid 404 5m;
    }
}

The reverse proxy does work but I don't know what is causing the conflicting server name cause I can't see any duplicates in my config. Can anyone help clean up my config?

Maxoholic avatar
cn flag
You can try `nginx -T` (note the capital T) for more verbose output, then paste it here so we can take a closer look.
Score:0
us flag
nay

You should look at all nginx config to find if there another config file contain the same domain.
you can use grep -R "img.somedomain.com" /etc/nginx/ to do the search.make sure /etc/nginx/ is your nginx config path.

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.