Nignx

Nignx

思维导图 https://download.csdn.net/download/lanlingxueyu/88813711

使用

命令

-c
指定配置文件 默认路径–conf-path
-p
指定nginx安装目录
-g
临时指定一些全局配置项,以使新的配置项生效
nginx -g “pid /var/nginx/test.pid”
约束条件:
配置项不能与默认路径下nginx.conf 冲突,否则无法启动
以-g方式启动的nginx服务执行其他命令时,需要把 -g带上,否则可能出现配置项不匹配的情况
-t
测试配置文件是否有错误
-s
发送信号:stop, quit, reopen, reload

配置

调试经常和定位问题
daemon on | off;
是否守护进程方式运行
master_process on | off;
是否以master/woker方式工作
off; master进程自身处理请求
error_log /path/file level;
日志设置
debug_points [stop | abort]
stop: 到代码调试点发出SIGSTOP信号以用于调试
abort: 产生一个coredump文件,可以使用gdb查看信息
debug_connection [IP | CIDR]
这个配置项实际上属于事件类配置 events { } 才有效

events {
debug_connection 10.224.66.14;
debug_connection 10.224.57.0/24;
}

worker_rlimit_core size;
限制coredump核心转储文件的大小
working_directory path;
指定coredump文件生成目录
注意: 如果日志级别设定到debug, 必须configure 编译时加入–with-debug配置项
正常运行的配置项
env VAR|VAR=VALUE
定义环境变量

env TESTPATH=/TMP/;

include /path/file;
嵌入其他配置文件

include mime.types;
include vhost/*.conf;

pid path/file;
pid文件的路径

默认: pid logs/nginx.pid;

user username [groupname];
nginx worker进程运行的用户及

你可能感兴趣的:(网络,服务器,运维)