#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;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
upstream web_app{
server 192.168.0.57:8080 weight=10;
server 192.168.0.11:80 weight=5;
}
server {
listen 80;
server_name localhost;
access_log logs/host.access.log main;
index index.jsp index.html;
location /{
proxy_pass http://web_app;
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;
client_max_body_size 30m;
client_body_buffer_size 128k;
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
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配置 +负载均衡+https协议 完整的配置以及nginx 启动 停止 重新加载
Nginx配置负载均衡、配置网页数据动静分离、请求日志打印详细配置、日志自动切割、自动压缩、自动删除
nginx配置负载均衡和反向代理示例
简单介绍Nginx,实现负载均衡的配置和使用缓存存储静态资源文件,并可以通过purge模块删除缓存
nginx负载均衡配置-windows.docx
网上大部分关于nginx负载均衡集群的教程都是linux环境,如何实现在windows配置nginx实现负载均衡集群呢!
Nginx实现负载均衡 web均衡负载 webservice负载均衡 Nginx实现负载均衡配制全说明 为了多台后台的web、webservice服务能均衡负载,可以使用nginx进行处理 1)配置文件全配制ok 2)有两个完整的web服务做例子,可以...
Nginx的负载均衡配置文件
主要介绍了nginx负载均衡配置,宕机自动切换方式,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
Nginx的负载均衡入门-张宴 Nginx的负载均衡入门-张宴
nginx+tomcat配置实现负载均衡,亲测可用
Linux(CentOS8) Nginx配置TCP负载均衡
nginx进行负载均衡的配置参考示例,及nginx支持https请求的配置参考示例
Nginx和tomcat配置负载均衡集群,互相学习哈,给大家参考,有问题可以做修改
Nginx-配置负载均衡的几种方式
使用nginx+eureka实现微服务的高负载均衡,提高网站的访问性能
我们使用的是软负载均衡器Nginx,而农行用的是F5硬负载均衡器,这里简单介绍下这两种技术: a、软件负载均衡解决方案 在一台服务器的操作系统上,安装一个附加软件来实现负载均衡,如Nginx负载均衡(我们...
nginx配置优化+负载均衡+动静分离详解
nginx负载均衡配置文件实例:基本配置说明文档和一个配置好的nginx.conf文件实例
FreeBSD 8.1下用nginx配置简单web负载均衡