【发布时间】:2017-03-16 07:36:22
【问题描述】:
我的上游有问题,我想知道我的 nginx 配置有什么问题:
upstream backends {
server 127.0.0.1:80;
server 188.200.200.200 backup;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html index.php;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
proxy_read_timeout 150;
proxy_pass http://backends;
proxy_set_header Host $host;
proxy_next_upstream error timeout http_500 http_502 http_503 http_504;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_read_timeout 150;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
location ~* \. (jpg|jpeg|gif|png|css|js|ico|xml|woff|ttf|otf|svg|woff2|eot)$ {
access_log off;
log_not_found off;
expires 30d;
}
它在日志中给出这条消息: connect() 在连接到上游时失败(111:连接被拒绝),客户端:xx.xx.xx.xx,服务器:localhost,请求:“GET / HTTP/1.1”,上游:“fastcgi://127.0.0.1: 9000"
有人可以帮助我吗?
提前致谢
【问题讨论】: