nginx实现MySQL负载均衡
usernobody; worker_processes1;#error_loglogs/error.log;
#error_loglogs/error.lognotice;
error_loglogs/error.loginfo;
#pid logs/nginx.pid;
events {
worker_connections1024;
}
include /usr/local/nginx-1.6.3/conf/tcp_proxy.conf;
http {
include mime.types;
default_typeapplication/octet-stream;
log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_loglogs/access.logmain;
sendfile on;
#tcp_nopush on;
#keepalive_timeout0;
keepalive_timeout65;
#gzipon;
server {
listen 3306;
server_namelocalhost;
#charset koi8-r;
#access_loglogs/host.access.logmain;
location / {
root html;
indexindex.html index.htm;
}
location /nginx_status {
stub_status on;
access_loglogs/nginx_status.log;
allow 10.195.197.124;
deny all;
}
#error_page404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504/50x.html;
location = /50x.html {
root html;
}
}
}
页:
[1]