一个完整的nginx配置案例,生产环境


  1. 一个完整配置例(生产环境中使用)
  2. user nobody nobody;
  3. worker_processes 4;
  4. worker_rlimit_nofile 51200;
  5. error_log logs/error.log notice;
  6. pid /var/run/nginx.pid;
  7. events {
  8. use epoll;
  9. worker_connections 51200;
  10. }
  11. http {
  12. server_tokens off;
  13. include mime.types;
  14. proxy_redirect off;
  15. proxy_set_header Host $host;
  16. proxy_set_header X-Real-IP $remote_addr;
  17. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  18. client_max_body_size 20m;
  19. client_body_buffer_size 256k;
  20. proxy_connect_timeout 90;
  21. proxy_send_timeout 90;
  22. proxy_read_timeout 90;
  23. proxy_buffer_size 128k;
  24. proxy_buffers 4 64k;
  25. proxy_busy_buffers_size 128k;
  26. proxy_temp_file_write_size 128k;
  27. default_type application/octet-stream;
  28. charset utf-8;
  29. client_body_temp_path /var/tmp/client_body_temp 1 2;
  30. proxy_temp_path /var/tmp/proxy_temp 1 2;
  31. fastcgi_temp_path /var/tmp/fastcgi_temp 1 2;
  32. uwsgi_temp_path /var/tmp/uwsgi_temp 1 2;
  33. scgi_temp_path /var/tmp/scgi_temp 1 2;
  34. ignore_invalid_headers on;
  35. server_names_hash_max_size 256;
  36. server_names_hash_bucket_size 64;
  37. client_header_buffer_size 8k;
  38. large_client_header_buffers 4 32k;
  39. connection_pool_size 256;
  40. request_pool_size 64k;
  41. output_buffers 2 128k;
  42. postpone_output 1460;
  43. client_header_timeout 1m;
  44. client_body_timeout 3m;
  45. send_timeout 3m;
  46. log_format main '$server_addr $remote_addr [$time_local] $msec+$connection '
  47. '"$request" $status $connection $request_time $body_bytes_sent "$http_referer" '
  48. '"$http_user_agent" "$http_x_forwarded_for"';
  49. open_log_file_cache max=1000 inactive=20s min_uses=1 valid=1m;
  50. access_log logs/access.log main;
  51. log_not_found on;
  52. sendfile on;
  53. tcp_nodelay on;
  54. tcp_nopush off;
  55. reset_timedout_connection on;
  56. keepalive_timeout 10 5;
  57. keepalive_requests 100;
  58. gzip on;
  59. gzip_http_version 1.1;
  60. gzip_vary on;
  61. gzip_proxied any;
  62. gzip_min_length 1024;
  63. gzip_comp_level 6;
  64. gzip_buffers 16 8k;
  65. gzip_proxied expired no-cache no-store private auth no_last_modified no_etag;
  66. gzip_types text/plain application/x-javascript text/css application/xml application/json;
  67. gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  68. upstream tomcat8080 {
  69. ip_hash;
  70. server 172.16.100.103:8080 weight=1 max_fails=2;
  71. server 172.16.100.104:8080 weight=1 max_fails=2;
  72. server 172.16.100.105:8080 weight=1 max_fails=2;
  73. }
  74. server {
  75. listen 80;
  76. server_name www.magedu.com;
  77. # config_apps_begin
  78. root /data/webapps/htdocs;
  79. access_log /var/logs/webapp.access.log main;
  80. error_log /var/logs/webapp.error.log notice;
  81. location / {
  82. location ~* ^.*/favicon.ico$ {
  83. root /data/webapps;
  84. expires 180d;
  85. break;
  86. }
  87. if ( !-f $request_filename ) {
  88. proxy_pass http://tomcat8080;
  89. break;
  90. }
  91. }
  92. error_page 500 502 503 504 /50x.html;
  93. location = /50x.html {
  94. root html;
  95. }
  96. }
  97. server {
  98. listen 8088;
  99. server_name nginx_status;
  100. location / {
  101. access_log off;
  102. deny all;
  103. return 503;
  104. }
  105. location /status {
  106. stub_status on;
  107. access_log off;
  108. allow 127.0.0.1;
  109. allow 172.16.100.71;
  110. deny all;
  111. }
  112. }
  113. }

一个完整配置例nginx.conf(生产环境中使用)的更多相关文章

  1. 生产环境中tomcat的配置

    生产环境中要以daemon方式运行tomcat 通常在开发环境中,我们使用$CATALINA_HOME/bin/startup.sh来启动tomcat, 使用$CATALINA_HOME/bin/sh ...

  2. 【原】Storm Local模式和生产环境中Topology运行配置

    Storm入门教程 1. Storm基础 Storm Storm主要特点 Storm基本概念 Storm调度器 Storm配置 Guaranteeing Message Processing(消息处理 ...

  3. Spring Boot 利用 nginx 实现生产环境的伪热更新

    当我们在服务器部署Java程序,特别是使用了 Spring Boot 生成单一 Jar 文件部署的时候,单一文件为我们开发单来的极大的便利性,保障程序的完整性.但同时对我们修改程序中的任何一处都带来重 ...

  4. 10: Django + Uwsgi + Nginx 的生产环境部署

    1.1 一些重要概念 1.Web协议介绍 Web协议出现顺序: CGI -> FCGI -> WSGI -> uwsgi 1. CGI:  最早的协议 2. FCGI:  比CGI快 ...

  5. Django + Uwsgi + Nginx 的生产环境部署实战

    目录 Django + Uwsgi + Nginx 的生产环境部署实战 安装Uwsgi 一.使用命令来启动django项目 二.使用配置文件来启动我们的Django项目 安装Nginx 配置Nginx ...

  6. 11: Django + gunicorn + Nginx 的生产环境部署

    1.1 gunicorn介绍   1.Gunicorn 1. Gunicorn是使用Python实现的WSGI服务器, 直接提供了http服务, 并且在woker上提供了多种选择, gevent, e ...

  7. Django+Nginx+uWSGI生产环境部署

    生产环境中的数据流 参考文档: wsgi详解:https://blog.csdn.net/li_101357/article/details/52748323 wsgi协议介绍(萌新版):https: ...

  8. Confluence 6 从生产环境中恢复一个测试实例

    请参考 Restoring a Test Instance from Production 页面中的内容获得更多完整的说明. 很多 Confluence 的管理员将会使用生产实例运行完整数据和服务的 ...

  9. 配置Django框架为生产环境的注意事项(DEBUG=False)

    问题描述: Django1.10版本中框架中settings.py配置文件 配置文件settings.py配置了下面两项: DEBUG= False ALLOWED_HOSTS = ['*'] #这样 ...

随机推荐

  1. 【Codeforces Round #433 (Div. 1) C】Boredom(树状数组)

    [链接]h在这里写链接 [题意] 给你一个n*n的矩阵. 其中每一列都有一个点. 任意两个点构成了矩形的两个对角点 ->即任意两个点确定了一个矩形. ->总共能确定n*(n-1)/2个矩形 ...

  2. 使用stringstream进行类型转换与字符串分割

    C++标准库中的<sstream>提供了比ANSI C的<stdio.h>更高级的一些功能,即单纯性.类型安全和可扩展性. 如果你已习惯了<stdio.h>风格的转 ...

  3. c++11 多线程 -- 基本使用

    c++11 多线程 – 基本使用 前言:这篇文章仅针对没有使用过c++11线程库的童鞋来高速入门,也是自己的一个简单记录,内容比較基础. 1.线程的基本使用 2.相互排斥量 3.条件变量 4.原子变量 ...

  4. 【Codeforces Round #437 (Div. 2) A】Between the Offices

    [链接]h在这里写链接 [题意] 在这里写题意 [题解] 在这里写题解 [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++.h> using n ...

  5. [Flexbox] Use Flex to Scale Background Image

    In this lesson we will use Flexbox to scale a background image to fit on the screen of our React Nat ...

  6. Android5.0(Lollipop) BLE蓝牙4.0+浅析demo连接(三)

    作者:Bgwan链接:https://zhuanlan.zhihu.com/p/23363591来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. Android5.0(L ...

  7. [outlook] [vba] Highlight text in body of incoming emails

    http://www.outlookcode.com/threads.aspx?forumid=2&messageid=33313 Sub CustomMailMessageRule(MyMa ...

  8. iis windows phpstudy安装redis扩展

    说明,我的服务器是2008 64位 php5.4.33 首先下载符合条件的redis扩展,是否符合条件可以参考https://pecl.php.net/package/redis,进入之后,点击&qu ...

  9. 【44.10%】【codeforces 723B】Text Document Analysis

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  10. java异常——捕获异常+再次抛出异常与异常链

    [0]README 0.1) 本文描述+源代码均 转自 core java volume 1, 旨在理解 java异常--捕获异常+再次抛出异常与异常链 的相关知识: [1]捕获异常相关 1.1)如果 ...