CentOS上手动配置nginx.services

本文详细解析了NGINX作为动态Web平台的基础服务配置文件,包括单元描述、依赖服务、服务类型、PID文件位置、预启动指令、启动与重载命令、停止信号、超时设置、进程管理及文件描述符限制等关键参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[Unit]
Description=Dynamic web platform based on NGINX and LuaJIT
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
# Nginx will fail to start if /run/nginx/pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target

  

转载于:https://www.cnblogs.com/winnerREN/p/9888335.html

[root@iZbp11irq8z6b1plo30y63Z ~]# systemctl status nginxnginx.service - LSB: starts the nginx web server Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled) Active: active (running) since Fri 2025-03-07 10:28:52 CST; 1h 0min ago Docs: man:systemd-sysv-generator(8) Process: 32241 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=0/SUCCESS) Tasks: 4 Memory: 50.5M CGroup: /system.slice/nginx.service ├─32253 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf ├─32254 nginx: worker process ├─32255 nginx: worker process └─32256 nginx: cache manager process Mar 07 10:28:52 iZbp11irq8z6b1plo30y63Z systemd[1]: Starting LSB: starts the nginx web server... Mar 07 10:28:52 iZbp11irq8z6b1plo30y63Z systemd[1]: Started LSB: starts the nginx web server. Mar 07 10:28:52 iZbp11irq8z6b1plo30y63Z nginx[32241]: Starting nginx... done [root@iZbp11irq8z6b1plo30y63Z ~]# ps -ef | grep nginx root 2177 26119 0 10:56 pts/1 00:00:00 sudo vi /etc/yum.repos.d/nginx.repo root 2178 2177 0 10:56 pts/1 00:00:00 vi /etc/yum.repos.d/nginx.repo root 5707 26119 0 11:29 pts/1 00:00:00 grep --color=auto nginx root 32253 1 0 10:28 ? 00:00:00 nginx: master process /www/server/nginx/sbin/nginx -c /www/server/nginx/conf/nginx.conf www 32254 32253 0 10:28 ? 00:00:00 nginx: worker process www 32255 32253 0 10:28 ? 00:00:00 nginx: worker process www 32256 32253 0 10:28 ? 00:00:00 nginx: cache manager process [root@iZbp11irq8z6b1plo30y63Z ~]#
最新发布
03-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值