zoukankan      html  css  js  c++  java
  • nginx配置详解

    user  www www;   //nginx在运行时使用的账号的权限 
    
    worker_processes auto; //开启进程数,cpu核数的1-2倍,查看cpu核数的值:cat /proc/cpuinfo
    
    error_log  /home/wwwlogs/nginx_error.log;//日志文件好pid文件保存的目录
    
    pid        /usr/local/nginx/logs/nginx.pid;//存储ngin进程的pid信息
    worker_rlimit_nofile 51200;//最大值65535 一个工作进程最多打开的文件连接数,与worker_connections配置数相同 events { use epoll;//使用于Linux内核2.6版本及以后的系统。 worker_connections 51200;//最大值65535,每一个子进程最大的连接数,总的最大连接数就应该是 进程数*这一项,受到linux系统的限制, 默认情况linux限制每一个进程只能最大打开1024个文件(在linux下所有的东西都是一个文件), 可以通过这个命令来设置:ulimit -a ,ulimit-SHn 65535 multi_accept on; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 256k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]."; server_tokens off; log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; access_log off; //一个网站 server { listen 80 default_server; #listen [::]:80 default_server ipv6only=on; server_name www.lnmp.org; index index.html index.htm index.php; root /home/wwwroot/default;//网站目录 #error_page 404 /404.html;//错误页面地址 include enable-php.conf; location /nginx_status { stub_status on; access_log off; } location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d;//缓存保存时间 } location ~ .*.(js|css)?$ { expires 12h;//缓存保存时间 } location ~ /. { deny all; } access_log /home/wwwlogs/access.log access;//以access的格式保存日志文件 } include vhost/*.conf;//加载更多配置项 }
  • 相关阅读:
    反向代理实例
    nginx常用命令和配置
    nginx的安装
    Can Live View boot up images acquired from 64bit OS evidence?
    What is the behavior of lnk files?
    EnCase v7 search hits in compound files?
    How to search compound files
    iOS 8.3 JB ready
    Sunglasses
    现代福尔摩斯
  • 原文地址:https://www.cnblogs.com/ganwenjun/p/6666488.html
Copyright © 2011-2022 走看看