编程技术分享平台

网站首页 > 技术教程 正文

Nginx基本配置参数解析(nginx详细配置)

xnh888 2024-09-08 01:46:15 技术教程 32 ℃ 0 评论

[root@server ~]# nginx -tV

nginx version: nginx/1.22.0

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)

built with OpenSSL 1.0.2k-fips 26 Jan 2017

TLS SNI support enabled

configure arguments:

--user=nginx 用户nginx来跑worker进程

--group=nginx 组nginx

--prefix=/usr/local/nginx 安装目录

--sbin-path=/usr/local/nginx/sbin/nginx 可执行命令目录

--conf-path=/usr/local/nginx/conf/nginx.conf 配置文件目录

--error-log-path=/usr/local/nginx/logs/error.log 错误日志目录

--http-log-path=/usr/local/nginx/logs/access.log 访问日志目录

--pid-path=/usr/local/nginx/logs/nginx.pid 进程pid文件目录

--lock-path=/var/lock/subsys/nginx 锁文件目录

--with-http_stub_status_module 状态模块

--with-http_ssl_module 加密模块

--with-http_gzip_static_module 压缩模块

--with-pcre 重定向模块

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

[root@server ~]# ps -ef |grep nginx

root 1135 1 0 14:03 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx

nginx 1136 1135 0 14:03 ? 00:00:00 nginx: worker process

nginx 1137 1135 0 14:03 ? 00:00:00 nginx: worker process

nginx 1138 1135 0 14:03 ? 00:00:00 nginx: worker process

nginx 1139 1135 0 14:03 ? 00:00:00 nginx: worker process

[root@server ~]#

在Linux系统的目录/var/run下面一般都会看到很多的*.pid文件。而且往往新安装的程序在运行后也会在/var/run目录下面产生自己的pid文件。那么这些pid文件有什么作用呢?它的内容又是什么呢?

(1) pid文件的内容:pid文件为文本文件,内容只有一行, 记录了该进程的ID。 用cat命令可以看到。

(2) pid文件的作用:防止进程启动多个副本。只有获得pid文件(固定路径固定文件名)写入权限(F_WRLCK)的进程才能正常启动并把自身的PID写入该文件中。其它同一个程序的多余进程则自动退出。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表