本文主要是介绍nginx 配置 upstream backup 报错,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
启动 nginx 的时候 报错 错误信息如下:
nginx: [emerg] balancing method does not support parameter "backup" in /usr/local/nginx/conf/nginx.conf:40
原因是backup 和 ip_hash 无法同时使用(Ip_hash balancer does not support backup servers and weight)。
#user nobody;
worker_processes 1;#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024;
}http {include mime.types;default_type application/octet-stream;sendfile on;upstream backend {ip_hash;server 127.0.0.1:8010;server 127.0.0.1:8080 max_fail=3 weight=2;server www.baidu.com backup;} server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root /usr/www/tyy/;index tyy.html;}location /static {alias /usr/www/static/;}location =/baidu.html {proxy_pass http://www.baidu.com;}location /tyy/ {proxy_pass http://127.0.0.1:8010;}#error_page 404 /404.html;# redirect server error pages to the static page /50x.html#error_page 500 502 503 504 /50x.html;location = /50x.html {root html;}}
}
这篇关于nginx 配置 upstream backup 报错的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!