一个完整配置例nginx.conf(生产环境中使用)
一个完整的nginx配置案例,生产环境
-
一个完整配置例(生产环境中使用)
-
-
user nobody nobody;
-
worker_processes 4;
-
worker_rlimit_nofile 51200;
-
-
error_log logs/error.log notice;
-
-
pid /var/run/nginx.pid;
-
-
events {
-
use epoll;
-
worker_connections 51200;
-
}
-
-
http {
-
server_tokens off;
-
include mime.types;
-
-
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 20m;
-
client_body_buffer_size 256k;
-
proxy_connect_timeout 90;
-
proxy_send_timeout 90;
-
proxy_read_timeout 90;
-
proxy_buffer_size 128k;
-
proxy_buffers 4 64k;
-
proxy_busy_buffers_size 128k;
-
proxy_temp_file_write_size 128k;
-
-
default_type application/octet-stream;
-
charset utf-8;
-
-
client_body_temp_path /var/tmp/client_body_temp 1 2;
-
proxy_temp_path /var/tmp/proxy_temp 1 2;
-
fastcgi_temp_path /var/tmp/fastcgi_temp 1 2;
-
uwsgi_temp_path /var/tmp/uwsgi_temp 1 2;
-
scgi_temp_path /var/tmp/scgi_temp 1 2;
-
-
ignore_invalid_headers on;
-
server_names_hash_max_size 256;
-
server_names_hash_bucket_size 64;
-
client_header_buffer_size 8k;
-
large_client_header_buffers 4 32k;
-
connection_pool_size 256;
-
request_pool_size 64k;
-
-
output_buffers 2 128k;
-
postpone_output 1460;
-
-
client_header_timeout 1m;
-
client_body_timeout 3m;
-
send_timeout 3m;
-
-
-
log_format main '$server_addr $remote_addr [$time_local] $msec+$connection '
-
'"$request" $status $connection $request_time $body_bytes_sent "$http_referer" '
-
'"$http_user_agent" "$http_x_forwarded_for"';
-
-
open_log_file_cache max=1000 inactive=20s min_uses=1 valid=1m;
-
-
access_log logs/access.log main;
-
log_not_found on;
-
-
-
sendfile on;
-
tcp_nodelay on;
-
tcp_nopush off;
-
-
reset_timedout_connection on;
-
keepalive_timeout 10 5;
-
keepalive_requests 100;
-
-
-
gzip on;
-
gzip_http_version 1.1;
-
gzip_vary on;
-
gzip_proxied any;
-
gzip_min_length 1024;
-
gzip_comp_level 6;
-
gzip_buffers 16 8k;
-
gzip_proxied expired no-cache no-store private auth no_last_modified no_etag;
-
gzip_types text/plain application/x-javascript text/css application/xml application/json;
-
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
-
-
-
upstream tomcat8080 {
-
ip_hash;
-
-
server 172.16.100.103:8080 weight=1 max_fails=2;
-
server 172.16.100.104:8080 weight=1 max_fails=2;
-
server 172.16.100.105:8080 weight=1 max_fails=2;
-
}
-
-
server {
-
listen 80;
-
server_name www.magedu.com;
-
# config_apps_begin
-
root /data/webapps/htdocs;
-
access_log /var/logs/webapp.access.log main;
-
error_log /var/logs/webapp.error.log notice;
-
-
location / {
-
-
location ~* ^.*/favicon.ico$ {
-
root /data/webapps;
-
expires 180d;
-
break;
-
}
-
-
if ( !-f $request_filename ) {
-
proxy_pass http://tomcat8080;
-
break;
-
}
-
}
-
-
error_page 500 502 503 504 /50x.html;
-
location = /50x.html {
-
root html;
-
}
-
}
-
-
server {
-
listen 8088;
-
server_name nginx_status;
-
-
location / {
-
access_log off;
-
deny all;
-
return 503;
-
}
-
-
location /status {
-
stub_status on;
-
access_log off;
-
allow 127.0.0.1;
-
allow 172.16.100.71;
-
deny all;
-
}
-
}
-
-
}
一个完整配置例nginx.conf(生产环境中使用)的更多相关文章
- 生产环境中tomcat的配置
生产环境中要以daemon方式运行tomcat 通常在开发环境中,我们使用$CATALINA_HOME/bin/startup.sh来启动tomcat, 使用$CATALINA_HOME/bin/sh ...
- 【原】Storm Local模式和生产环境中Topology运行配置
Storm入门教程 1. Storm基础 Storm Storm主要特点 Storm基本概念 Storm调度器 Storm配置 Guaranteeing Message Processing(消息处理 ...
- Spring Boot 利用 nginx 实现生产环境的伪热更新
当我们在服务器部署Java程序,特别是使用了 Spring Boot 生成单一 Jar 文件部署的时候,单一文件为我们开发单来的极大的便利性,保障程序的完整性.但同时对我们修改程序中的任何一处都带来重 ...
- 10: Django + Uwsgi + Nginx 的生产环境部署
1.1 一些重要概念 1.Web协议介绍 Web协议出现顺序: CGI -> FCGI -> WSGI -> uwsgi 1. CGI: 最早的协议 2. FCGI: 比CGI快 ...
- Django + Uwsgi + Nginx 的生产环境部署实战
目录 Django + Uwsgi + Nginx 的生产环境部署实战 安装Uwsgi 一.使用命令来启动django项目 二.使用配置文件来启动我们的Django项目 安装Nginx 配置Nginx ...
- 11: Django + gunicorn + Nginx 的生产环境部署
1.1 gunicorn介绍 1.Gunicorn 1. Gunicorn是使用Python实现的WSGI服务器, 直接提供了http服务, 并且在woker上提供了多种选择, gevent, e ...
- Django+Nginx+uWSGI生产环境部署
生产环境中的数据流 参考文档: wsgi详解:https://blog.csdn.net/li_101357/article/details/52748323 wsgi协议介绍(萌新版):https: ...
- Confluence 6 从生产环境中恢复一个测试实例
请参考 Restoring a Test Instance from Production 页面中的内容获得更多完整的说明. 很多 Confluence 的管理员将会使用生产实例运行完整数据和服务的 ...
- 配置Django框架为生产环境的注意事项(DEBUG=False)
问题描述: Django1.10版本中框架中settings.py配置文件 配置文件settings.py配置了下面两项: DEBUG= False ALLOWED_HOSTS = ['*'] #这样 ...
随机推荐
- 洛谷 P1211 [USACO1.3]牛式 Prime Cryptarithm
P1211 [USACO1.3]牛式 Prime Cryptarithm 题目描述 下面是一个乘法竖式,如果用我们给定的那n个数字来取代*,可以使式子成立的话,我们就叫这个式子牛式. *** x ** ...
- Android利用FTP实现与PC的上传和下载,实现二维码扫描下载
之前给老板所带的本科生课程实验所写的代码,拿出来分享一下. 下载地址: https://github.com/smartshuai/ConnectHelper.git
- (转)c运行库、c标准库、windows API的区别和联系
C运行时库函数C运行时库函数是指C语言本身支持的一些基本函数,通常是汇编直接实现的. API函数API函数是操作系统为方便用户设计应用程序而提供的实现特定功能的函数,API函数也是C语言的函数实现的 ...
- 【转】CentOS/RHEL/OracleLinux使用UDEV配置ASMDISK
转自:http://blog.csdn.net/staricqxyz/article/details/8332566 RHEL 5 / CentOS 5 / Oracle Linux 5 [root@ ...
- 11.5 Android显示系统框架_Vsync机制_代码分析
5.5 surfaceflinger对vsync的处理buffer状态图画得不错:http://ju.outofmemory.cn/entry/146313 android设备可能连有多个显示器,AP ...
- Java基础学习总结(28)——Java对各种排序算法的实现
这里总结下各种排序算法的java实现 冒泡排序 public class BubbleSort { publicstaticint[] bubbleSort(int[] array) { if(arr ...
- Unity自带网络功能——NetworkView组件、Serialize、RPC
Unity拥有大量的第三方插件,专门提供了对网络功能的支持.可是,大部分开发人员第一次接触到的还是Unity自带的网络功能,也就是大家常常说到的Unity Networking API.这些API是借 ...
- js读取json,纠结。。。
什么是json.先小抄一段: JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.採用全然独立于语言的文本格式, 是理想的数据交换格式,同一时候,JSO ...
- 10进制TO16进制
string DecToHex(int Dec_Num){ int num; string str_num; num = Dec_Num; while(num / 16 != 0) { int a = ...
- word中公式的排版及标题列表
1.首先建好你的标题,如标题1,标题2等等,你能够依次改变它们的字体,段落等格式,新建格式例如以下图所看到的 红圈处即建立新的格式,你能够建立不论什么你想要的格式,非常方便: 2.当你建立好了多个标题 ...