如果节点应用程序当前没有响应请求,我想默认使用php应用程序。 (即向下)。
我该怎么办?
以下是我的nginx配置
upstream my_servers {
least_conn;
#ip_hash; # ensures persistence of session id across servers
server 127.0.0.1:3001; # httpServer2 listens to port 8001
server 127.0.0.1:3000; # httpServer1 listens to port 8000
server 127.0.0.1:80; <---- THIS ONE IS THE PHP APP
#this could also be entirely a different host server
#Ex. server 113.333.123.190:8000;
}
server {
listen 80;
server_name weburl.com;
root /home/vince/Documents/weburl/static_php_player;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include snippets/fastcgi-php.conf;
}
}
答案 0 :(得分:0)
将备份选项添加到php服务器,否则所有请求将由3台服务器处理
upstream my_servers {
least_conn;
#ip_hash; # ensures persistence of session id across servers
server 127.0.0.1:3001; # httpServer2 listens to port 8001
server 127.0.0.1:3000; # httpServer1 listens to port 8000
server 127.0.0.1:80 backup; <---- THIS ONE IS THE PHP APP