• 注册
  • 查看作者
  • user nginx nginx;
    worker_processes auto;
    worker_rlimit_nofile 200000;

    pcre_jit on;

    ## Add modules
    #
    #load_module "/usr/lib64/nginx/modules/ngx_http_cache_purge_module.so";
    #load_module "/usr/lib64/nginx/modules/ngx_http_push_stream_module.so";
    #load_module "/usr/lib64/nginx/modules/ngx_pagespeed.so";
    #load_module "/usr/lib64/nginx/modules/ngx_http_brotli_filter_module.so";
    #load_module "/usr/lib64/nginx/modules/ngx_http_brotli_static_module.so";

    error_log /var/log/nginx/error.log;
    #error_log /var/log/nginx/error.log notice;
    #error_log /var/log/nginx/error.log info;
    pid /var/run/nginx.pid;

    events {
    worker_connections 2048;
    }

    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"'
    'cs=$upstream_cache_status';
    charset utf-8;
    access_log /var/log/nginx/access.log main;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    reset_timedout_connection on;
    keepalive_timeout 20;
    server_tokens off;
    server_names_hash_max_size 128;
    server_names_hash_bucket_size 256;

    client_header_timeout 5m;
    client_body_timeout 5m;
    send_timeout 5m;

    client_max_body_size 700m;
    connection_pool_size 256;
    client_body_buffer_size 1024k;
    client_header_buffer_size 8k;

    gzip off;

    #proxy_temp_path /var/lib/nginx/proxy 1 2;
    #proxy_cache_valid 20s;
    #proxy_cache_key $scheme$proxy_host$request_uri$cookie_user;
    #proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:400m inactive=120m max_size=500M;
    #proxy_cache_min_uses 2;

    proxy_cache_valid 5s;
    proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=one:8m max_size=300m inactive=1h;
    proxy_cache_path /var/lib/nginx/cache1 levels=1:2 keys_zone=two:8m max_size=300m inactive=1h;

    proxy_temp_path /var/lib/nginx/proxy 1 2;
    proxy_ignore_headers Expires Cache-Control;
    proxy_cache_use_stale error timeout invalid_header http_502;
    proxy_cache_bypass $cookie_session;
    proxy_no_cache $cookie_session;
    proxy_cache_min_uses 2;

    limit_conn_zone $binary_remote_addr zone=lone:10m;
    limit_req_zone $binary_remote_addr zone=ltwo:10m rate=5r/s;
    limit_req_zone $binary_remote_addr zone=lstrict:10m rate=1r/s;
    limit_req_zone $binary_remote_addr zone=highspeed:10m rate=10r/s;

    fastcgi_cache_path /var/lib/nginx/fpm levels=1:2 keys_zone=fcgi:8m max_size=200m inactive=1h;
    fastcgi_cache_path /var/lib/nginx/fpm2 levels=1:2 keys_zone=fcgi2:8m max_size=200m inactive=1h;
    # fastcgi_cache_key "$scheme$request_method$host$request_uri$cookie_user";
    fastcgi_temp_path /var/lib/nginx/fastcgi 1 2;
    fastcgi_ignore_headers Expires Cache-Control;
    fastcgi_cache_use_stale error timeout invalid_header;
    # fastcgi_param PHP_ADMIN_VALUE "display_errors=off";

    limit_conn_zone $binary_remote_addr zone=lfcgi:10m;
    limit_req_zone $binary_remote_addr zone=lfsci2:10m rate=5r/s;

    resolver 8.8.8.8 8.8.4.4 valid=300s ipv6=off;
    resolver_timeout 5s;

    map $http_accept $webp_suffix {
    "~*webp" ".webp";
    }

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See 链接
    # for more information.
    ModSecurityEnabled off;
    ModSecurityConfig modsecurity.conf;
    include /etc/nginx/conf.d/*.conf;

    index index.php index.html index.htm;

    server {
    root /var/www/html;
    access_log /etc/nginx/vhost_logs/default_access;
    error_log /etc/nginx/vhost_logs/default_error;
    location / {
    root /var/www/html;
    index index.php index.html index.htm;
    }
    }

    include /etc/nginx/sites-available/*.conf;

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

    # location / {
    # }
    #}

    # HTTPS server
    #
    #server {
    # listen 443;
    # server_name localhost;
    # root html;

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

    # ssl_session_timeout 5m;

    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers HIGH:!aNULL:!MD5;
    # ssl_prefer_server_ciphers on;

    # location / {
    # }
    #}

    }

    上海
  • 0
  • 0
  • 0
  • 2.2k
  • 请登录之后再进行评论

    登录
  • 做任务
  • 实时动态