Nginx配置
Ⅰ、Nginx配置文件的修改
修改nginx的默认配置文件:
CODE:
vi /etc/nginx/nginx.conf
按下面的内容修改Nginx的配置文件。兰色表示需要手动修改的内容,红色表示增加的内容:
#user nobody;
# 指定子进程数,酌情修改
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
# 最多可打开文件数
worker_rlimit_nofile 8196;
events {
# 最大并发数
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# 关掉错误日志
error_log /dev/null crit;
# 如果需要错误日志,就用下面这行替换上面这行
#error_log /var/log/nginx/error.log notice;
# 定义日志格式,对日志使用缓存,避免频繁的磁盘I/O操作
access_log /var/log/nginx/access.log combined buffer=1m;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
# 对静态文件和可压缩文件启用压缩,以节约网络带宽,提高访问速度
gzip on;
gzip_min_length 1k;
gzip_buffers 4 8k;
gzip_http_version 1.1;
gzip_comp_level 3;
gzip_types text/html text/css text/xml [...]
Add comment 一月 1st, 2010