Internal network DNS
seantang037
HOBBYOP

2 years ago

after append follow in nginx.conf:

resolver [fd12::10] ipv6=on valid=5s;

it seems not work.

Internal network DNS had changed?

11 Replies

2 years ago

It has not changed, I would recommend using Caddy instead, nginx with dynamic IPv6 domains is an absolute pain to setup properly.


seantang037
HOBBYOP

2 years ago

thank you very much. but I need nginx the feature of geoip. another suggestion?


2 years ago

Caddy supports geoip.


2 years ago

If you still need to use nginx, to be able to help I would need more info than "it seems not work"


seantang037
HOBBYOP

2 years ago

If you still need to use nginx, to be able to help I would need more info than "it seems not work"

when I redeploy backend service, nginx proxy_pass fail,

and, after restart nginx, proxy_pass works.


seantang037
HOBBYOP

2 years ago

it seams that redeploy server will change ipv6 address, but nginx dns cache not refresh.


2 years ago

Gotcha, you need to have nginx do dynamic DNS lookups, please do some research on this topic.

While you're at it, you would ideally want to set valid to 0s if nginx will let you do that.


kamihouse
HOBBY

a year ago

I was doing a similar configuration with nginx, php-fpm and docker.

I also had the same gateway timeout (502) problem whenever I deployed to the php-fpm container.

So, with the following adjustments I was able to solve the situation.

In addition to informing the resolver settings, I needed to put the domain (it needs to be the full domain, not the shortened one) in a variable to get the expected result.

location ~ \.php$ {
    resolver [fd12::10] valid=1s ipv6=on;
    resolver_timeout 2s;
    set $php_fpm_s "php-fpm.railway.internal:9000";
        
    fastcgi_pass $php_fpm_s;

    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
  • php:8.4-fpm-alpine3.20

  • nginx:mainline-alpine3.20-slim


a year ago

I can not recommend you to not use NGINX enough, valid=1s meas you will at some point hit a stale DNS value and will get an error.


brody

I can not recommend you to not use NGINX enough, valid=1s meas you will at some point hit a stale DNS value and will get an error.

kamihouse
HOBBY

a year ago

Thanks for the feedback @brody.

Do you think this could be a better way?

resolver [fd12::10] ipv6=on;

a year ago

You are removing the valid setting, so that's even worse.

Caddy is the better way here as it does not cache DNS at all.


Loading...