zoukankan      html  css  js  c++  java
  • Nginx配置记录【例3】

    C服务器,例:

    [root@82_www_db_2 conf.d]# egrep -v "^#|^$" /etc/nginx/nginx.conf

    user nginx;
    worker_processes 8;
    error_log /var/log/nginx/error.log;
    pid /var/run/nginx.pid;
    worker_rlimit_nofile 65520;
    include /usr/share/nginx/modules/*.conf;
    events {
        use epoll;
        worker_connections  10240;
    }
    http {
        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  /var/log/nginx/access.log  main;
        sendfile            on;
        tcp_nopush          on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;
        #gzip 压缩传输
        gzip on;
        gzip_min_length 1k;  #最小1K
        gzip_buffers 16 64K;
        #gzip_http_version 1.1;
        gzip_comp_level 6;
        gzip_types text/plain application/x-javascript text/css application/xml application/javascript image/jpeg image/gif image/png;
        gzip_vary on;
        include             /etc/nginx/mime.types;
        default_type        application/octet-stream;
        proxy_intercept_errors on;
        proxy_redirect off;
        proxy_set_header Host $host;
        #proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size 10m;
        client_body_buffer_size 328k;
        proxy_connect_timeout 90;
        proxy_read_timeout 90;
        proxy_send_timeout 90;
        proxy_buffer_size 40k;
        proxy_buffers 4 320k;
        proxy_busy_buffers_size 640k;
        proxy_temp_file_write_size  640k;  
        # Load modular configuration files from the /etc/nginx/conf.d directory.
        # See http://nginx.org/en/docs/ngx_core_module.html#include
        # for more information.
        include /etc/nginx/conf.d/*.conf;
    }
    

    [root@82_www_db_2 conf.d]# egrep -v "^#|^$" /etc/nginx/mime.types

    types {
        text/html                             html htm shtml;
        text/css                              css;
        text/xml                              xml;
        image/gif                             gif;
        image/jpeg                            jpeg jpg;
        application/javascript                js;
        application/atom+xml                  atom;
        application/rss+xml                   rss;
        text/mathml                           mml;
        text/plain                            txt;
        text/vnd.sun.j2me.app-descriptor      jad;
        text/vnd.wap.wml                      wml;
        text/x-component                      htc;
        image/png                             png;
        image/tiff                            tif tiff;
        image/vnd.wap.wbmp                    wbmp;
        image/x-icon                          ico;
        image/x-jng                           jng;
        image/x-ms-bmp                        bmp;
        image/svg+xml                         svg svgz;
        image/webp                            webp;
        application/x-font-truetype           otf;
        application/x-font-truetype           ttf;
        application/font-woff                 woff;
        application/java-archive              jar war ear;
        application/json                      json;
        application/mac-binhex40              hqx;
        application/msword                    doc;
        application/pdf                       pdf;
        application/postscript                ps eps ai;
        application/rtf                       rtf;
        application/vnd.apple.mpegurl         m3u8;
        application/vnd.ms-excel              xls;
        application/vnd.ms-fontobject         eot;
        application/vnd.ms-powerpoint         ppt;
        application/vnd.wap.wmlc              wmlc;
        application/vnd.google-earth.kml+xml  kml;
        application/vnd.google-earth.kmz      kmz;
        application/x-7z-compressed           7z;
        application/x-cocoa                   cco;
        application/x-java-archive-diff       jardiff;
        application/x-java-jnlp-file          jnlp;
        application/x-makeself                run;
        application/x-perl                    pl pm;
        application/x-pilot                   prc pdb;
        application/x-rar-compressed          rar;
        application/x-redhat-package-manager  rpm;
        application/x-sea                     sea;
        application/x-shockwave-flash         swf;
        application/x-stuffit                 sit;
        application/x-tcl                     tcl tk;
        application/x-x509-ca-cert            der pem crt;
        application/x-xpinstall               xpi;
        application/xhtml+xml                 xhtml;
        application/xspf+xml                  xspf;
        application/zip                       zip;
        application/octet-stream              bin exe dll;
        application/octet-stream              deb;
        application/octet-stream              dmg;
        application/octet-stream              iso img;
        application/octet-stream              msi msp msm;
        application/vnd.openxmlformats-officedocument.wordprocessingml.document    docx;
        application/vnd.openxmlformats-officedocument.spreadsheetml.sheet          xlsx;
        application/vnd.openxmlformats-officedocument.presentationml.presentation  pptx;
        audio/midi                            mid midi kar;
        audio/mpeg                            mp3;
        audio/ogg                             ogg;
        audio/x-m4a                           m4a;
        audio/x-realaudio                     ra;
        video/3gpp                            3gpp 3gp;
        video/mp2t                            ts;
        video/mp4                             mp4;
        video/mpeg                            mpeg mpg;
        video/quicktime                       mov;
        video/webm                            webm;
        video/x-flv                           flv;
        video/x-m4v                           m4v;
        video/x-mng                           mng;
        video/x-ms-asf                        asx asf;
        video/x-ms-wmv                        wmv;
        video/x-msvideo                       avi;
    }
    

      

      

    [root@82_www_db_2 conf.d]# pwd
    /etc/nginx/conf.d
    [root@82_www_db_2 conf.d]# ls
     gzgw.conf lwcdn.conf 

    [root@82_www_db_2 conf.d]# grep -v "^ #" gzgw.conf

    server {
            listen       80;
            server_name  www.abc.com abc.com m.abc.com gz.abc.com;
    
    
    	root /home/gzlongwen/www;
            location / {
                index  index.html index.htm index.php;
            }
    
    
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
            }
    
    
            location ~ .php$ {
                #root           html;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
    
            location = /favicon.ico {
                log_not_found off;
                access_log off;
            } 
    
        }
    

     

    [root@82_www_db_2 conf.d]# more lwcdn.conf

    server {
        listen       80;
        server_name  lwcdn.abc.com;
    
        location / {
           root /home/lwcdn;
           try_files $uri /index.html;
           expires 1d;
        }
    
        location ~* .(eot|ttf|woff|svg|otf)$ {
           root /home/lwcdn;
           add_header Access-Control-Allow-Origin *;
        } 
    
    }
    

      

  • 相关阅读:
    Verilog HDL Test Bench
    配置maven仓库
    mac上卸载oracle jdk 1.8.0_31
    Mac系统安装jdk和maven
    ActiveX的AssemblyInof.cs文件 IObjectSafety  接口
    C#破解dll
    Web Api 转
    dynamic
    无焦点窗体(转载)
    Linux操作系统基础知识part4
  • 原文地址:https://www.cnblogs.com/eos666/p/11818527.html
Copyright © 2011-2022 走看看