新网站建设风格室内设计和平面设计区别
参考的文章是《nginx配置详解》
 可以参考我以前的文章安装OpenResty。
 cd /usr/local/openresty切换目录,ls -l查看目录里边的内容。
 
 我的系统中,nginx目录是/usr/local/openresty/nginx,在这个目录里边有一些目录,如下:
client_body_temp
conf
fastcgi_temp
html
logs
proxy_temp
sbin
scgi_temp
uwsgi_temp
 

/usr/local/openresty/nginx/sbin/里边放的是可执行文件nginx。
 
/usr/local/openresty/nginx/logs/里边放的是日志,access.log是访问日志,error.log是错误日志。
 
 grep -v '^.*#' nginx/conf/nginx.conf | grep -v '^$'把没有注释并且不是空行的内容显示出来,内容如下:
worker_processes  1;
events {worker_connections  1024;
}
http {include       mime.types;default_type  application/octet-stream;sendfile        on;keepalive_timeout  65;server {listen       80;server_name  localhost;location / {root   html;index  index.html index.htm;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}}
}
 

块配置项,由一个块配置项名和一对大括号组成,比如events {}和http {},可以看到上边的配置文件中的配置项格式是配置项名 配置项值1 配置项值2 …… ;,比如worker_processes 1;和include mime.types;。
 配置项可以分为以下几类:
用于调试和分析问题的配置项
正常运行必需的配置项
优化性能的配置项
事件配置项
接下来把上边的配置文件写上注释:
# nginx启动进程数,推荐等于CPU个数,这里表明只启动一个工作进程
worker_processes  1;
#  事件配置块开始
events {# 每个进程最大连接个数,这里是1024worker_connections  1024;
}
# HTTP配置块开始
http {# 引入MIME类型映射表文件include       mime.types;# 全局局默认映射类型为application/octet-streamdefault_type  application/octet-stream;# 启用零复制机制sendfile        on;# 保持连接超时时间为65skeepalive_timeout  65;# server配置块开始server {# 监听80端口,访问时只需要输入ip就可以,不需要加上端口listen       80;# 虚拟主机的名字设置为localhostserver_name  localhost;# location配置块开始location / {# 服务默认启动目录root   html;# 默认访问页面index  index.html index.htm;}# 错误页面error_page   500 502 503 504  /50x.html;# location配置块location = /50x.html {root   html;}}
}
 
此文章为8月Day 26学习笔记,内容来源于极客时间《Linux 实战技能 100 讲》。
