大漠駝鈴

          置身浩瀚的沙漠,方向最為重要,希望此blog能向大漠駝鈴一樣,給我方向和指引。
          Java,Php,Shell,Python,服務器運維,大數據,SEO, 網站開發、運維,云服務技術支持,IM服務供應商, FreeSwitch搭建,技術支持等. 技術討論QQ群:428622099
          隨筆 - 238, 文章 - 3, 評論 - 117, 引用 - 0
          數據加載中……

          Nginx簡單配置

          #運行Nginx的用戶
          user  nginx;
          #Nginx運行的進程數,擁有幾個邏輯CPU,就設置為幾個worker_processes 為宜,但是 worker_processes 超過8個就沒有多大意義了
          worker_processes  8;

          #制定進程到cpu(四cpu:0001 0010 0100 1000)
          worker_cpu_affinity 0001 0010 0100 1000 0001 0010 0100 1000;

          #worker_rlimit_nofile配置要和系統的單進程打開文件數一致。
          worker_rlimit_nofile 100000;

          #錯誤日志,在出現錯的時候可以tail查看,查找具體的錯誤
          error_log   /var/log/nginx/error.log;
          #error_log  /var/log/nginx/error.log  notice;
          #error_log  /var/log/nginx/error.log  info;

          #pid文件
          pid        /var/run/nginx.pid;


          events {
               #使用epoll(linux2.6的高性能方式)
              use epoll;
              #每個進程最大連接數(最大連接=連接數x進程數)
              worker_connections  10240;
          }


          http {
              #文件擴展名與文件類型映射表
              include       /etc/nginx/mime.types;
              #默認文件類型
              default_type  application/octet-stream;
              #日志文件格式
              log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                                '$status $body_bytes_sent "$http_referer" '
                                '"$http_user_agent" "$http_x_forwarded_for"';

              #access log    
              access_log  /var/log/nginx/access.log  main;

              #tcp and gzip相關配置
              sendfile        on;
              tcp_nopush      on;
              tcp_nodelay     on;
              server_tokens   off;
              gzip            on;
              gzip_static     on;
              gzip_comp_level 5;
              gzip_min_length 1024;
              #默認編碼
              charset UTF-8;


              #嵌套upstream.conf
              include upstream.conf;
              
              #長鏈接超時時間
              keepalive_timeout  65;
              limit_conn_zone   $binary_remote_addr  zone=addr:10m;

              # Load config files from the /etc/nginx/conf.d directory
              include /etc/nginx/conf.d/*.conf;

             
          }

          posted on 2013-10-11 14:41 草原上的駱駝 閱讀(244) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 台中市| 梓潼县| 泽库县| 湖州市| 阳曲县| 时尚| 百色市| 灵丘县| 陵川县| 宜阳县| 苗栗县| 九江市| 陵水| 化州市| 突泉县| 新泰市| 城市| 衡南县| 革吉县| 新河县| 黎川县| 临泉县| 延津县| 运城市| 行唐县| 宜兰县| 岳池县| 濉溪县| 互助| 涪陵区| 西贡区| 文成县| 久治县| 阳江市| 晋州市| 祁东县| 日土县| 葵青区| 高清| 大庆市| 禹州市|