nginx负载均衡配置文件
2014-10-23 09:07
288 查看
#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; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream testxx { server 192.168.0.189 weight=3; #跳三下 server 192.168.0.222 weight=1; #跳一下 } server { listen 80; server_name localhost; location /{ proxy_pass http://testxx; #proxy_redirect off; #proxy_set_header Host $host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} #error_page 404 /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; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} }
nginx 下有两个apache
就加几句话
upstream testxx { server 192.168.0.189 weight=3; #跳三下 server 192.168.0.222 weight=1; #跳一下 }
location /{ proxy_pass http://testxx;[/code]}
相关文章推荐
- Ngin的配置文件nginx.conf完整配置说明(包括fastcgi和负载均衡设置)
- Nginx安装,启动,配置,编辑文件,负载均衡
- Nginx的反向代理和负载均衡的配置文件写法上的区别
- nginx服务器介绍,负载均衡,文件配置,内核优化
- Nginx相关指令和Nginx+tomcat配置集群负载均衡配置文件nginx.conf
- 一个完整的nginx配置文件范例参考(含负载均衡)
- nginx 负载均衡配置文件
- Nginx配置文件详细说明+nginx配置tomcat负载均衡
- Linux 安装nginx、配置文件及负载均衡
- 【Day27】什么是nginx,以及通过 nginx 实现静态文件转发、反向代理和负载均衡的配置
- Nginx负载均衡配置文件
- Nginx配置文件详细说明,包括负载均衡
- nginx.conf文件配置及nginx重启脚本
- nginx配置文件祥解
- 转载:nginx配置文件的location标签执行顺序和反向代理配置
- nginx配置文件详解
- 详解nginx.conf文件配置项(包括负载均衡)
- nginx(二)初识配置文件
- nginx配置文件详解
- Nginx配置文件中文注释详解