Nginx 메 인 프로필 을 통 해 각 구성 요소 의 기능 을 이해 합 니 다.

4436 단어 문건Nginx주 설정
0. 설명
    Nginx 기능 은 매우 강력 합 니 다. 메 인 프로필 nginx. conf 의 사용 만으로 도 나타 날 수 있 습 니 다. 학습 과 누락 을 편리 하 게 하기 위해 메 인 프로필 의 전체 내용 을 열거 하고 개인의 이 해 를 더 해 노트 로 하여 기억 을 깊이 있 게 합 니 다.
1. Nginx 메 인 프로필 과 설명
    다음 과 같다.
#user  nobody;
# ====================================Main ==================================== #
# Main  Nginx      
worker_processes  1;    # worker     

#error_log  logs/error.log;            # Nginx     
#error_log  logs/error.log  notice;    # notice, info       
#error_log  logs/error.log  info;      #     warn|error|crit     

#pid        logs/nginx.pid;
# ====================================Main ==================================== #


# ====================================events ==================================== #
# events  Nginx      
events {
    worker_connections  1024;    #   worker          
}
# ====================================events ==================================== #


# ====================================HTTP ==================================== #
# http  Nginx      
http {
    include       mime.types;    # Nginx          
    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  logs/access.log  main;
    # =========      ======== #

    sendfile        on;    #         
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;    #       

    #gzip  on;

    server {                    # server  ,             
        listen       80;        #        
        server_name  localhost; #           

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {            # location  
            root   html;        #       ,   Nginx     
            index  index.html index.htm;    #        ,       
        }
    # [    1:  Nginx status] #
    ##status
server{
    listen 80;
    server_name status.etiantian.org;
    location / {
      stub_status on;
      access_log off;
    }
 }
    # [    1:  Nginx status] #

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;    #      http    ,  50x.html    
        location = /50x.html {        # location  ,  50x.html
            root   html;              #           html
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
# ====================================HTTP ==================================== #

2. 다음 단 계 는 무엇 을 할 것 인가
    본 박문 을 지속 적 으로 업데이트 하고 사용 하면 서 학습 과 이 해 를 깊이 있 게 한다.
3. 참고 자료
《 늙 은 남자 아이 에 게 리 눅 스 운영: 웹 클 러 스 터 》 를 배우다.

좋은 웹페이지 즐겨찾기