Nginx and DNS
On ubuntu-12.04, I need to run this
> sudo dpkg-reconfigure resolvconf
To solve the Error
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything
First of all, let me describe the issue.
I plan to use Nginx to proxy external domain which need 8.8.8.8 to resolve the DNS. Depend on the header value, the request main proxy to and internal IP which the domain name and IP configuration is configured in /etc/hosts.
Install the DNS service on Local
> sudo apt-get install dnsmasq
Start running the service
> sudo service dnsmasq start
The NGINX configuration will be similar to this:
map $http_user_agent $target {
default 'https://ocp.sillycatcloudbeta.com/SillycatServer';
"oldclientsproxy" 'http://local-hosts-external-ip:5080/SillycatServer';
"test" 'http://requestbin.fullcontact.com/1fio7ty1/SillycatServer';
}
location /SillycatServer/useragentapi {
resolver 127.0.0.1;
proxy_pass $target/useragentapi$is_args$args;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
}
location /SillycatServer/provisioning {
resolver 127.0.0.1;
proxy_pass $target/provisioning$is_args$args;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
}
Then the resolver will first look up /etc/hosts and then it will working similar as 8.8.8.8 to look up AMAZON AWS domain.
References:
https://github.com/arrivu/beacon/wiki/Solution-for--------resolvconf:-Error:--etc-resolv.conf-isn't-a-symlink,-not-doing-anything
https://askubuntu.com/questions/54888/resolvconf-u-gives-the-error-resolvconf-error-etc-resolv-conf-must-be-a-sym
http://www.enkichen.com/2017/05/23/dnsmasq-introduce/
https://stackoverflow.com/questions/8305015/when-using-proxy-pass-can-etc-hosts-be-used-to-resolve-domain-names-instead-of/8559797#8559797
On ubuntu-12.04, I need to run this
> sudo dpkg-reconfigure resolvconf
To solve the Error
resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything
First of all, let me describe the issue.
I plan to use Nginx to proxy external domain which need 8.8.8.8 to resolve the DNS. Depend on the header value, the request main proxy to and internal IP which the domain name and IP configuration is configured in /etc/hosts.
Install the DNS service on Local
> sudo apt-get install dnsmasq
Start running the service
> sudo service dnsmasq start
The NGINX configuration will be similar to this:
map $http_user_agent $target {
default 'https://ocp.sillycatcloudbeta.com/SillycatServer';
"oldclientsproxy" 'http://local-hosts-external-ip:5080/SillycatServer';
"test" 'http://requestbin.fullcontact.com/1fio7ty1/SillycatServer';
}
location /SillycatServer/useragentapi {
resolver 127.0.0.1;
proxy_pass $target/useragentapi$is_args$args;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
}
location /SillycatServer/provisioning {
resolver 127.0.0.1;
proxy_pass $target/provisioning$is_args$args;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
}
Then the resolver will first look up /etc/hosts and then it will working similar as 8.8.8.8 to look up AMAZON AWS domain.
References:
https://github.com/arrivu/beacon/wiki/Solution-for--------resolvconf:-Error:--etc-resolv.conf-isn't-a-symlink,-not-doing-anything
https://askubuntu.com/questions/54888/resolvconf-u-gives-the-error-resolvconf-error-etc-resolv-conf-must-be-a-sym
http://www.enkichen.com/2017/05/23/dnsmasq-introduce/
https://stackoverflow.com/questions/8305015/when-using-proxy-pass-can-etc-hosts-be-used-to-resolve-domain-names-instead-of/8559797#8559797