nginx 를 설치 하고 설정 합 니 다.

9808 단어 링크 ux 운영nginx
nginx 에서 가장 흔히 볼 수 있 는 설정 1, wokerconnections: 최대 병발 수: wokerproces*woker_conections 2, user [epoil] / [rgsig] / [select] / [poil] / 이벤트 사용 모델 을 정의 합 니 다. nginx 가 자동 으로 3, accept 를 선택 하도록 권장 합 니 다.mutex [on | of] 상호 배척 잠 금 메커니즘, 부하 균형 잠 금 / on 사용 시 여러 woker 가 돌아 가면 서 직렬 화 된 응답 요청 4, locktile /PATH/TO/LOCK_FILE;
공식 문서
https://www.nginx.cn/doc/
성능 최적화 참조:
https://www.cnblogs.com/itcomputer/p/6441998.html
가장 많이 사용 되 는 것 은: user nignx nginx 사용자 woker프로 세 스 프로 세 스 수 wokerpriority 는 워 커 프로 세 스 의 nice 값 을 가리 키 며 우선 순 위 를 높 입 니 다.woker_connections1024;
기업 등급 배치 분석 참조
https://blog.csdn.net/weixin_44313519/article/details/91865439

#user  nobody;
worker_processes  2;

#error_log  /home/usr/local/nginx/logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
pid        logs/nginx.pid;


events {
    worker_connections  10240;
}


http {
    client_header_buffer_size 16k;
    large_client_header_buffers 4 16k;

    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"';
        #tcp_nopush     on;
    keepalive_timeout  65;

    upstream admin {
        server 127.0.0.1:8081;
    }

    upstream api {
        server 127.0.0.1:8080;
    }

    upstream wechat {
        server 127.0.0.1:8082;
    }

    upstream www {
        server 127.0.0.1:8083;
    }

    upstream  svn {
        server 10.162.5.36:3690;
    }

    upstream testwechat {
        server 10.162.5.72:8089;
    }

    upstream testapi {
        server 10.162.5.38:8900;
    }
    upstream yanzheng {
        server 127.0.0.1:8084;
    }



    upstream testadmin {
        server 10.162.5.72:8091;
    }


server {
        listen 80;
        server_name localhost;
        charset utf-8;
        root html;
        access_log  logs/sclzsi.log  main;
        }

server {
        listen       80;
        server_name  www.sclzsi.com;

        charset utf-8;

        location / {
                rewrite . http://182.130.246.34:9528/msimsWebM/;
        }

        access_log  logs/sclzsi.log  main;

       }


server {
        listen       80;
        server_name sclzsi.cn;

        charset utf-8;

        location / {
                proxy_pass  http://www;

        }
        access_log  logs/www.log  main;


        }

server {
        listen       80;
        server_name twechat.sclzsi.cn 220.166.104.172;

        charset utf-8;

        location / {
                proxy_pass  http://10.162.5.39:8100;
                proxy_buffer_size 64k;
                proxy_buffers   4 32k;
                proxy_busy_buffers_size 64k;

        }

        location ^~ /vx/ {
                proxy_pass http://10.162.5.39/;
                proxy_buffer_size 64k;
                proxy_buffers   4 32k;
                proxy_busy_buffers_size 64k;
        }

        location ^~ /attachment/ {
                proxy_pass http://10.162.5.39:8201/;
                proxy_buffer_size 64k;
                proxy_buffers   4 32k;
                proxy_busy_buffers_size 64k;

        }

        location ^~ /admin/ {
                proxy_pass http://10.162.5.39:8200/;
                proxy_buffer_size 64k;
                proxy_buffers   4 32k;
                proxy_busy_buffers_size 64k;

        }

        location ^~ /vx-si/ {
                proxy_pass http://10.162.5.37:8020/;
                proxy_buffer_size 64k;
                proxy_buffers   4 32k;
                proxy_busy_buffers_size 64k;

        }
}

#     , ssl              。
server {
        listen 443 ssl;
        #  HTTPS        443。
        #        HTTPS       ,     Nginx    。
        #     Nginx 1.15.0     ,   listen 443 ssl  listen 443 ssl on。
        server_name xcx.sclzsi.cn; #   yourdomain.com          。
        root html;
        index index.html index.htm;
        ssl_certificate cert/cert-file-name-pem.pem;  #   cert-file-name.pem              。
        ssl_certificate_key cert/cert-file-name-key.key; #   cert-file-name.key                。
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        #            。
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #     TLS     。
        ssl_prefer_server_ciphers on;
        location / {
                proxy_pass  http://10.162.5.38:8880;
                root html;  #    。
                index index.html index.htm;
        }
}


server {
        listen       80;
        server_name xcx.sclzsi.cn;
        rewrite ^(.*)$ https://$host$1; #   HTTP    rewrite      HTTPS。
        charset utf-8;

        location / {
                proxy_pass  http://10.162.5.38:8880;

        }
}
#         
server {
        listen       80;
        server_name xcx.sclzsi.cn;
        location ~ .*\.(gif|jpg|jpeg|png)$ {
            expires 24h;
            root /www/xcx/;#        
            proxy_store on;
            proxy_store_access user:rw group:rw all:rw;
            proxy_temp_path         /;#      
            proxy_redirect          off;

            proxy_set_header        Host xcx.sclzsi.cn;
            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 1280k;
            proxy_connect_timeout   900;
            proxy_send_timeout      900;
            proxy_read_timeout      900;
            proxy_buffer_size       40k;
            proxy_buffers           40 320k;
            proxy_busy_buffers_size 640k;
            proxy_temp_file_write_size 640k;
            if ( !-e $request_filename)
            {
                 proxy_pass  http://10.162.5.38:8880;#      
            }
        }

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

        error_page   500 =200 502 503 504  /50x.html;  //         
        location = /50x.html {
            root   html;
        }

}

server {
        listen       80;
        server_name www.sclzsi.cn;

        charset utf-8;
        location /WechatIMG49.jpeg {
                root html;
        }
        location /WechatIMG50.jpeg {
                root html;
        }

        location /logs.tar.gz {
                root html;
        }
        location / {
                proxy_pass  http://www;
        }
        access_log  logs/www.log  main;


        }


server {
        listen       80;
        server_name svn.sclzsi.cn;

        charset utf-8;

        location / {
                proxy_pass  http://svn;
                client_max_body_size  20m;
        }
        access_log  logs/svn.log  main;


        }


server {
        listen       80;
        server_name  admin.sclzsi.cn;

        charset utf-8;

        location / {
                proxy_pass  http://admin;

        }

        access_log  logs/admin.log  main;

       }


server {
        listen       80;
        server_name  api.sclzsi.cn;

        charset utf-8;

        location / {
                proxy_pass  http://api;
        }

        access_log  logs/api.log  main;

       }


server {
        listen       80;
        server_name  wechat.sclzsi.cn;

        charset utf-8;
        location /MP_verify_h7FTZfPnx5k3ebAQ.txt {
                root html;
        }

        location / {
                proxy_pass  http://wechat;
        }

        access_log  logs/wechat.log  main;

       }



server {
        listen       80;
        server_name  www.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://www;
        }

        access_log  logs/www.log  main;

       }

server {
        listen       80;
        server_name  svn.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://svn;
                client_max_body_size  20m;
        }

        access_log  logs/svn.log  main;

       }


server {
        listen       80;
        server_name  admin.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://admin;
        }

        access_log  logs/admin.log  main;

       }

server {
        listen       80;
        server_name  api.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://api;
        }

        access_log  logs/api.log  main;

       }

server {
        listen       80;
        server_name  wechat.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://wechat;
        }

        access_log  logs/wechat.log  main;

       }

server {
        listen       80;
        server_name  testwechat.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://testwechat;
        }

        access_log  logs/testwechat.log  main;

       }

server {
        listen       80;
        server_name  testapi.sclzsi.cn;

        charset utf-8;

        location / {
                proxy_pass  http://testapi;
        }

        access_log  logs/testapi.log  main;

       }

server {
        listen       80;
        server_name  testadmin.sclzsi.com;

        charset utf-8;

        location / {
                proxy_pass  http://testadmin;
        }

        access_log  logs/testadmin.log  main;

       }
server {
        listen       80;
        server_name  yz.sclzsi.cn;

        charset utf-8;

        location / {
                proxy_pass  http://yanzheng;
        }

        access_log  logs/yanzheng.log  main;

       }




}

좋은 웹페이지 즐겨찾기