首页 / 负载均衡 / Nginx负载均衡+动静分离
Nginx负载均衡+动静分离
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Nginx负载均衡+动静分离,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2723字,纯文字阅读大概需要4分钟。
内容图文
![Nginx负载均衡+动静分离](/upload/InfoBanner/zyjiaocheng/155/a97f74d8f98e4ceda116635082c103c1.jpg)
worker_processes 2;
worker_rlimit_nofile 102400;
events {
use epoll;
worker_connections 102400;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 60;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
client_max_body_size 8m;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
fastcgi_cache_path /service/nginx/fastcgi_cache levels=1:2 keys_z inactive=5m max_size=1g;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 8 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
proxy_connect_timeout 5;
proxy_read_timeout 60;
proxy_send_timeout 5;
proxy_buffer_size 16k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
upstream zph_web {
server 192.168.1.134:80 weight=1 max_fails=2 fail_timeout=30s;
server 192.168.1.135:80 weight=1 max_fails=2 fail_timeout=30s;
}
##
server {
listen 80;
server_name www.zhoupeihao.com zhoupeihao.com;
root /data/web/www;
index index.html index.php index.htm index.shtml;
location / {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://zph_web;
expires 1d;
}
location /ngx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(php|jsp|cgi)?$
{
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://zph_web;
}
location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root /data/web/www;
expires 7d;
}
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了Nginx负载均衡+动静分离,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
内容总结
以上是互联网集市为您收集整理的Nginx负载均衡+动静分离全部内容,希望文章能够帮你解决Nginx负载均衡+动静分离所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。