worker321 发表于 2018-11-12 10:02:13

Nginx + keepalived

user            nginx;  
worker_processes4;
  
error_log/var/log/nginx/error.log;
  
#error_log/var/log/nginx/error.lognotice;
  
#error_log/var/log/nginx/error.loginfo;
  
pid      /var/run/nginx.pid;
  
events {
  worker_connections1024;
  
}
  
http {
  include       /etc/nginx/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_log/var/log/nginx/access.logmain;
  sendfile      on;
  #tcp_nopush   on;
  #keepalive_timeout0;
  keepalive_timeout65;
  #gzipon;
  # Load config files from the /etc/nginx/conf.d directory
  # The default server is in conf.d/default.conf
  upstream backend
  {
  ip_hash;
  server172.16.249.74:80;
  server 172.16.249.75:80 ;
  
}
  server {
  listen 80;
  server_name www.firefox.com;
  location / {
  root    /var/www/html;
  index index.php index.html index.htm;
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Formarded-For proxy_add_x_forwarded_for;
  proxy_pass http://backend;
  
}
  location /nginx {
  access_log off;
  stub_status on;
  
}
  log_formataccess '$remote_addr - $remote_user [$time_local] "$request" '
  '$status $body_bytes_sent "$http_referer" '
  '"$http_user_agent" "$http_x_forwarded_for"';
  access_log /data/logs/access.log access;
  
}
  
}


页: [1]
查看完整版本: Nginx + keepalived