nginx 파일 서버 구축

5396 단어 Nginx
설치 생략, 설정 파일 직접 붙 이기:
#Nginx      
worker_processes  4;

#            ,[debug|info|notice|warn|crit]
error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#    ID      
#pid        logs/nginx.pid;

#  nginx              ,             (ulimit -n) nginx     ,  nginx           ,     ulimit -n      
worker_rlimit_nofile 65535;

events {
    #  :            socket     (~ 64K)
    worker_connections  5120;
}


http {
    #             
    include       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"';
    #       。          
    #1.$remote_addr  $http_x_forwarded_for         ip  ;
    #2.$remote_user :           ;
    #3.$time_local :           
    #4.$request  :       url http  
    #5.$status :        
    #6.$body_bytes_sent :                
    #7.$http_referer :                
    #8.$http_user_agent :             

    #       ,           
    #access_log  logs/access.log  main;

    #            ,  IO  
    #error_log logs/error.log crit;
    #    
    #access_log     off;


    #    
    charset utf-8;

    #      hash   
    #server_names_hash_bucket_size 128;

    #               
    #client_max_body_size 8m;

    #           hearerbuffer  
    #client_header_buffer_size 32k;

    #                        
    #large_client_header_buffers 4 64k;

    #        
    sendfile        on;

    #      
    #tcp_nopush     on;

    #         ,    
    keepalive_timeout  120;

    #            
    #client_header_timeout 10;

    #               
    #client_body_timeout 10;

    #         
    #send_timeout 10;

    #  gzip    
    #gzip  on;

    #        
    #gzip_min_length 1k;

    #     
    #gzip_buffers 4 16k;

    #    (  1.1,     squid2.5   1.0)
    #gzip_http_version 1.0;
    #     1-9     ,      ,    , CPU   
    #gzip_comp_level 2;


    #          
    server {
        listen       80;
        server_name  localhost;

    #    ,         ,      
    #charset utf-8;

    #          
    #access_log  logs/host.access.log  main;

    # URL    
        location / {
        #    ,         
        root   /usr/local/nginx/html;
        autoindex on;
        autoindex_exact_size on;
        autoindex_localtime on;
        }
    }
}

좋은 웹페이지 즐겨찾기