[emerg]: invalid parameter "backup" error on Ubuntu
Maxim Dounin
mdounin at mdounin.ru
Tue Sep 8 20:44:33 MSD 2009
Hello!
On Tue, Sep 08, 2009 at 11:49:07AM -0400, stefancaunter wrote:
> By hostname do you mean "http://backend" (upstream name) ?
>
> proxy_pass http://backend;
Directive proxy_pass accepts either upstream name as defined
earlier via upstream{} block or backend hostname (or ip, or unix
socket). In the later case it implicitly creates upstream
block with single server inside.
Therefore this will work as expected:
http {
upstream backend {
server 192.168.0.1:80;
server 192.168.0.2:80 backup;
}
server {
...
location / {
proxy_pass http://backend;
}
}
}
And this will fail claiming it can't use "backup", as nginx will
interpret "backend" string as hostname that should be resolved via
DNS and will be confused by "upstream backend { ... }" that comes
later on:
http {
server {
...
location / {
proxy_pass http://backend;
}
}
upstream backend {
server 192.168.0.1:80;
server 192.168.0.2:80 backup;
}
}
Maxim Dounin
More information about the nginx
mailing list