mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-05-13 05:51:29 +00:00
Attempt to fix #5335 by allowing resovler generation to be opt-out with a env var
This commit is contained in:
parent
52be66c43e
commit
67d40e186f
4 changed files with 25 additions and 11 deletions
|
|
@ -47,10 +47,10 @@ http {
|
|||
proxy_cache_path /var/lib/nginx/cache/private levels=1:2 keys_zone=private-cache:5m max_size=1024m;
|
||||
|
||||
# Log format and fallback log file
|
||||
include /etc/nginx/conf.d/include/log-proxy.conf;
|
||||
include /etc/nginx/conf.d/include/log-proxy[.]conf;
|
||||
|
||||
# Dynamically generated resolvers file
|
||||
include /etc/nginx/conf.d/include/resolvers.conf;
|
||||
include /etc/nginx/conf.d/include/resolvers[.]conf;
|
||||
|
||||
# Default upstream scheme
|
||||
map $host $forward_scheme {
|
||||
|
|
@ -76,7 +76,7 @@ http {
|
|||
set_real_ip_from 172.16.0.0/12; # Includes Docker subnet
|
||||
set_real_ip_from 192.168.0.0/16;
|
||||
# NPM generated CDN ip ranges:
|
||||
include conf.d/include/ip_ranges.conf;
|
||||
include conf.d/include/ip_ranges[.]conf;
|
||||
# always put the following 2 lines after ip subnets:
|
||||
real_ip_header X-Real-IP;
|
||||
real_ip_recursive on;
|
||||
|
|
@ -98,7 +98,7 @@ http {
|
|||
|
||||
stream {
|
||||
# Log format and fallback log file
|
||||
include /etc/nginx/conf.d/include/log-stream.conf;
|
||||
include /etc/nginx/conf.d/include/log-stream[.]conf;
|
||||
|
||||
# Files generated by NPM
|
||||
include /data/nginx/stream/*.conf;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ log_info 'Dynamic resolvers ...'
|
|||
|
||||
# Dynamically generate resolvers file, if resolver is IPv6, enclose in `[]`
|
||||
# thanks @tfmm
|
||||
if [ "$(is_true "$DISABLE_IPV6")" = '1' ]; then
|
||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
||||
else
|
||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
||||
if [ "$(is_true "${DISABLE_RESOLVER:-}")" = '0' ]; then
|
||||
if [ "$(is_true "${DISABLE_IPV6:-}")" = '1' ]; then
|
||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) ipv6=off valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
||||
else
|
||||
echo resolver "$(awk 'BEGIN{ORS=" "} $1=="nameserver" { sub(/%.*$/,"",$2); print ($2 ~ ":")? "["$2"]": $2}' /etc/resolv.conf) valid=10s;" > /etc/nginx/conf.d/include/resolvers.conf
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ process_folder () {
|
|||
FILES=$(find "$1" -type f -name "*.conf")
|
||||
SED_REGEX=
|
||||
|
||||
if [ "$(is_true "$DISABLE_IPV6")" = '1' ]; then
|
||||
if [ "$(is_true "${DISABLE_IPV6:-}")" = '1' ]; then
|
||||
# IPV6 is disabled
|
||||
echo "Disabling IPV6 in hosts in: $1"
|
||||
SED_REGEX='s/^([^#]*)listen \[::\]/\1#listen [::]/g'
|
||||
|
|
|
|||
|
|
@ -231,8 +231,20 @@ load_module /usr/lib/nginx/modules/ngx_stream_geoip2_module.so;
|
|||
|
||||
Setting these environment variables will create the default user on startup, skipping the UI first user setup screen:
|
||||
|
||||
```
|
||||
```yml
|
||||
environment:
|
||||
INITIAL_ADMIN_EMAIL: my@example.com
|
||||
INITIAL_ADMIN_PASSWORD: mypassword1
|
||||
```
|
||||
|
||||
## Disable Nginx Resolver
|
||||
|
||||
On startup, we generate a resolvers directive for Nginx unless this is defined:
|
||||
|
||||
```yml
|
||||
environment:
|
||||
DISABLE_RESOLVER: true
|
||||
```
|
||||
|
||||
In this configuration, all DNS queries performed by Nginx will fall to the `/etc/hosts` file
|
||||
and then the `/etc/resolv.conf`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue