【发布时间】:2011-07-16 18:38:32
【问题描述】:
我用 nginx+php-fpm 和 mysql 设置了服务器。 我有另一台只安装了 php-fpm 的服务器,所以想用作负载平衡。 但是当我使用这个带有 php-fpm 作为负载均衡器的 dedacted 服务器时,打开页面时出现错误:“访问被拒绝。”
/etc/nginx/nginx.conf
user www-data;
worker_processes 3;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
#gzip on;
upstream php {
server dedicatedserverip:9000;
}
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites-enabled/site.org.conf
server {
listen 81;
server_name site.org www.site.org;
access_log /var/log/nginx/site.org.log;
error_log /var/log/nginx/site.org.log;
root /home/www/site.org;
index index.php;
location ~ .php$ {
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/www/$fastcgi_script_name;
}
}
为什么会出现这个错误?当我只将 fastcgi_pass 更改为 127.0.0.1:9000 - 一切正常。
【问题讨论】: