大漠駝鈴

          置身浩瀚的沙漠,方向最為重要,希望此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 草原上的駱駝 閱讀(246) 評論(0)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 永胜县| 柳江县| 广元市| 南投县| 思茅市| 定陶县| 平定县| 桓台县| 连州市| 元谋县| 德令哈市| 准格尔旗| 南昌县| 南城县| 安丘市| 敖汉旗| 板桥市| 庄浪县| 马关县| 临湘市| 新郑市| 正定县| 深水埗区| 布尔津县| 拉萨市| 光泽县| 涿州市| 新津县| 宝兴县| 海安县| 叶城县| 万宁市| 淮安市| 资兴市| 朝阳县| 栾川县| 盐池县| 壶关县| 泰兴市| 即墨市| 平邑县|