三台服务器
主 174 装 NGINX
从 170,191 装 PHP
三台服务器防火墙和 SELINUX 都已经关闭了
主服务器装好 Nginx 后,直接访问能看到欢迎页面
从服务器装好 php 后,直接用 PHP -S ip:port 启动,访问能看到正常页面
三台服务器的 /home/wwwroot 目录下分别有几个相同的测试文件
主服务器 174
nginx/conf.d/default.conf
upstream myServer{
server 192.168.199.191:9000 max_fails=3 fail_timeout=10s;
server 192.168.199.170:9000 max_fails=3 fail_timeout=10s;
}
server {
listen 80;
server_name 192.168.199.174;
location / {
root /home/wwwroot;
index index.html index.htm;
}
location ~ \.php$ {
root /home/wwwroot;
fastcgi_pass myServer;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
从服务器 170 191
/usr/local/etc/php-fpm.d/www.conf
[www]
; 担心是用户权限问题,所以把 nobody 改成了 root
; 用 php-fpm -R 启动
user = root
group = root
listen = [::]:9000
listen.allowed_clients = any
request_terminate_timeout = 0
但最终结果是:
2017/07/13 10:28:10 [error] 2199#2199: *10 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.191:9000", host: "192.168.199.174"
2017/07/13 10:28:10 [warn] 2199#2199: *10 upstream server temporarily disabled while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.191:9000", host: "192.168.199.174"
2017/07/13 10:28:10 [error] 2199#2199: *10 upstream prematurely closed connection while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.170:9000", host: "192.168.199.174"
2017/07/13 10:28:10 [warn] 2199#2199: *10 upstream server temporarily disabled while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.170:9000", host: "192.168.199.174"
求问,毛病出在那里?
1
iguoji OP ```
2017/07/13 10:31:15 [error] 2199#2199: *13 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.170:9000", host: "192.168.199.174" 2017/07/13 10:31:15 [warn] 2199#2199: *13 upstream server temporarily disabled while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.170:9000", host: "192.168.199.174" 2017/07/13 10:31:15 [error] 2199#2199: *13 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.191:9000", host: "192.168.199.174" 2017/07/13 10:31:15 [warn] 2199#2199: *13 upstream server temporarily disabled while reading response header from upstream, client: 192.168.199.222, server: 192.168.199.174, request: "GET /1.php HTTP/1.1", upstream: "fastcgi://192.168.199.191:9000", host: "192.168.199.174" ``` |
2
akrf 2017-07-13 10:43:01 +08:00
listen = [::]:9000
这是 ipv6 的 any ip 吧。。。用 0.0.0.0 的 ipv4 any ip 试试。。。 |
4
oksbsb 2017-07-13 11:21:42 +08:00
174 跑 php 修改 fastcgi_pass myServer; 指向本机试试
|