标签:http反向代理服务 nginx 项目管理 代理服务器 负载均衡 并发
#运行用户 #user nobody; #启动进程,通常设置成和CPU的数量相同。 worker_processes 1; #全局错误日志及PID文件 error_log logs/error.log info; pid logs/nginx.pid; worker_rlimit_nofile 65536; #工作模式及连接上限 events { #单个后台worker process进程的最大并发连接数 worker_connections 65536; } #设定http服务器,利用它的反向代理功能提供负载均衡支持 http { #设定mime类型,类型由mime.type文件定义 include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; #sendfile 指令指定 nginx 是否调用 sendfile 函数(zero copy 方式)来输出文件,对于普通应用, #必须设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为 off,以平衡磁盘与网络I/O处理速度,降低系统的uptime. sendfile on; tcp_nopush on; keepalive_timeout 65; tcp_nodelay on; #开启gzip压缩 gzip on; #设定请求缓冲 client_max_body_size 50m; fastcgi_intercept_errors on; proxy_buffer_size 128k; proxy_buffers 32 32k; proxy_busy_buffers_size 128k; fastcgi_buffer_size 128k; fastcgi_buffers 32 32k; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '"$http_referer" $status $body_bytes_sent $request_body ' '"$http_user_agent" "$http_x_forwarded_for"'; #设定负载均衡的服务器列表 upstream www.test.com { server 127.0.0.1:8080; } server { listen 80; #定义使用www.test.com访问 server_name www.test.com; access_log logs/khaccess.log main; #前台 #对应的项目中的action rewrite ^/$ /index!index.action last; rewrite ^/home/?$ /index!home.action last; rewrite ^/p/(.+)/ /index!index.action?channel=$1 last; rewrite ^/index/mobile/?$ /index!mobile.action last; # 正则表达式 rewrite ^/noticeindex/?$ /index!noticeindex.action last; rewrite ^/index/?$ /index!index.action last; rewrite ^/register/?$ /register!register.action last; rewrite ^/login/?$ /register!login.action last; rewrite ^/flow/next/?$ /flow!next.action last; rewrite ^/flow/previous/([0-9a-zA-Z]+)/?$ /flow!previous.action?previous=$1 last; rewrite ^/flow/back/?$ /flow!back.action last; rewrite ^/flow/reset/?$ /flow!reset.action last; rewrite ^/auth/upload/?$ /upload!show.action last; rewrite ^/auth/video/?$ /videoVerify!show.action last; rewrite ^/auth/ca/?$ /certreq!show.action last; rewrite ^/user/invest/?$ /userAccountSet!userAccountSet.action last; rewrite ^/user/agreement/?$ /agreement!gotoSign.action last; rewrite ^/user/exam/?$ /risk!paper.action last; rewrite ^/auth/brach/?$ /info!outlets.action last; rewrite ^/user/setpass/?$ /setting!gotoSetting.action last; rewrite ^/user/deposity/?$ /deposity!gotoBind.action last; rewrite ^/user/apply/?$ /apply!gotoApply.action last; rewrite ^/user/callback/?$ /callback!callback.action last; rewrite ^/auth/profile/?$ /info!profile.action last; rewrite ^/audit/check/?$ /audit!audit.action last; rewrite ^/user/deposity_show_agree/?$ /deposity!showAgreement.action last; rewrite ^/faq/?$ /index!faq.action last; rewrite ^/user/deposity_guide/?$ /deposity!guide.action last; rewrite ^/reserve/?$ /reserve!toAdd.action last; rewrite ^/audit/audit/?$ /audit!audit.action last; rewrite ^/services/?$ /services/listServices last; rewrite ^/services/UserWebService/?$ /services/UserWebService last; location / { proxy_pass http://www.test.com; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-real-uri $request; } } }
标签:http反向代理服务 nginx 项目管理 代理服务器 负载均衡 并发
原文地址:http://blog.csdn.net/u013412066/article/details/46560589