使用nginx反向代理做负载均衡
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream Tomcat {
#ip_hash;
server 192.168.1.16:8080;
server 192.168.1.17:8080;
}
server{
listen 80;
server_name 192.168.1.10;
error_page 403 404 = /index.html;
error_page 500 502 503 504 /50x.html;
location / {
proxy_pass http://Tomcat;
proxy_redirect default;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.ht {
deny all;
}
}
}
除特别注明外,本站所有文章均为奇妙伞原创,转载请注明出处来自https://qm3.com.cn/post/211.html