1. When configuring the nginx backup server, when the other two servers are unavailable, jump to the customized page. But it did not take effect after the actual configuration; please check what is wrong with my configuration
IP of the host where nginx is installed: 192.168.109.210
IP of the other two hosts where apache is installed: 192.168.109.208 and 192.168.109.209
2.Code segment
http{
upstream mysvr {
server 192.168.109.208 weight=1 max_fails=2 fail_timeout=2;
server 192.168.109.209 weight=1 max_fails=2 fail_timeout=2;
server 127.0.0.1:80 backup;
}
server {
listen 80;
server_name localhost;
#设置错误页面
root /data/www/errorpage;
index index.html;
location / {
#设置反向代理
#proxy_pass http://192.168.109.208;
proxy_pass http://mysvr;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
3. Configured error page index.html
[root@yunwei109-210 errorpage]# more index.html
<h1>Sorry, I reported an error! (O_O)</h1>
[root@yunwei109-210 errorpage]# pwd
/data/www/errorpage
4. Error message (after stopping the other 2 servers)
Current error page
Correct error page
Sorry, I reported an error!
Add in http segment:
For details, please visit:
http://nginx.org/en/docs/http...
http://nginx.org/en/docs/http...