配置nginx.conf文件:
1.
least_conn;
server 192.168.0.1:8080 max_fails=3 fail_timeout=10s;
}
2.
upstream front.my.test.com {//tomcat01
least_conn;
server 192.168.0.1:8080 max_fails=3 fail_timeout=10s;
}
upstream back.my.test.com {//tomcat02
least_conn;
server 192.168.0.2:8081 max_fails=3 fail_timeout=10s;
}
3.
server {
listen 80;
server_name test.fyh.com;
ssi on;
ssi_silent_errors on;
access_log /app/web_log/my.access.log urchin;
error_log /app/web_log/my.error.log error;
location / {
proxy_redirect off;
proxy_pass http://back.my.test.com;
}
location / {
proxy_redirect off;
proxy_pass http://front.my.test.com;
}
error_page 404 http://www.test.com/errorpage.html;
}