服务器-Nginx配置
来源:互联网 发布:imap4 端口 编辑:程序博客网 时间:2024/05/29 14:12
服务器-Nginx配置
1. 配置conf/nginx.conf
从vhost
目录中加载配置文件
使用include
指令引入vhost目录下的.conf
文件
worker_processes 1;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include vhost/*.conf;}
2. 配置允许上传的文件的最大大小
在location节点
下添加一行client_max_body_size 1000m;
upstream files-tech { server localhost:8280;}server { listen 80; server_name files.iuie.tech files.iuie.pub; location / { proxy_pass http://files-tech; proxy_read_timeout 300; proxy_send_timeout 300; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $http_x_forwarded_for; client_max_body_size 1000m; } location ~ /\.ht{ deny all; }}
3. 配置集群
在upstream
节点内添加多个server节点即可,这样的默认配置是以均分的方式实现负载均衡
upstream files-tech { server localhost:8280; server localhost:8380;}server { listen 80; server_name files.iuie.tech files.iuie.pub; location / { proxy_pass http://files-tech; proxy_read_timeout 300; proxy_send_timeout 300; proxy_set_header Host $host:80; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $http_x_forwarded_for; client_max_body_size 1000m; } location ~ /\.ht{ deny all; }}
当然,你也可以给每个节点添加权重weight
,权重值越大,越容易被分配。
upstream files-tech { server localhost:8280 weight=1; server localhost:8380 weight=5;}...
更多关于权重的内容可以参考
http://blog.csdn.net/zhangskd/article/details/50194069
阅读全文
0 0
- 配置Nginx服务器虚拟目录
- nginx服务器的配置
- Nginx缓存服务器配置
- nginx配置图片服务器
- nginx服务器配置
- Nginx配置https服务器
- nginx 配置HTTPS服务器
- nginx配置图片服务器
- Nginx服务器配置指令
- Nginx服务器基本配置
- Nginx配置服务器SSI
- nginx服务器配置详解
- nginx服务器的配置
- 服务器nginx+nodejs配置
- nginx配置https服务器
- nginx服务器配置
- 【服务器】nginx二级域名配置
- nginx配置web服务器
- 计算机网络原理第一章学习总结
- NeHe tutorial 课程列表
- 笔记
- ACM PKU 题目分类(完整整理版本)
- BZOJ1787 [Ahoi2008]Meet 紧急集合 【LCA】
- 服务器-Nginx配置
- WPF 项目中遇到的问题
- 2017-12-09 杭电OJ2003 《求绝对值》
- react中将数据存放在缓存中的方法和将数据从缓存中取出的方法
- maven聚合与继承
- 图论4
- 传苹果供应商开造AR眼镜 广州妇儿配AI医生能看32种病
- 赠票福利!英伟达人工智能大讲堂上海站开始报名了!
- 模板方法模式深度解析(一)