nginx配置

user  nginx; worker_processes  10; worker_rlimit_nofile 100000;

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  1024;     use epoll; }

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"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;     tcp_nopush      on;     tcp_nodelay     on;     server_tokens   on;     gzip            on;     gzip_static     on;     gzip_comp_level 5;     gzip_min_length 1024;     keepalive_timeout  65;     limit_conn_zone   $binary_remote_addr  zone=addr:10m;

    # Load config files from the /etc/nginx/conf.d directory    # include /etc/nginx/conf.d/*.conf;

    server {         limit_conn addr 10;         listen       80;         server_name  _;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

            root   /var/www/html;             index  index.html index.htm;             autoindex on;

        # 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;     #    server_name  localhost;

    #    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 / {     #        root   html;     #        index  index.html index.htm;     #    }     #}

}

原文地址:https://www.cnblogs.com/lubing666666/p/3910230.html