网站首页 > 云服务器 正文
目录
linux查看nginx启动路径
由于系统中有多个nginx目录,不知道哪一个哪一个才是真正的正在运行的服务,记录查看nginx启动路径定位。
查找nginx的pid
[root@wskh xpe]# netstat -anop | grep 0.0.0.0:80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2320/nginx: master off (0.00/0/0)
查找指定pid正在运行服务的启动路径
[root@wskh xpe]# ll /proc/2320/exe lrwxrwxrwx 1 root root 0 11月 16 11:29 /proc/2320/exe -> /usr/local/nginx/sbin/nginx
查找nginx启动使用的配置文件
[root@wskh xpe]# /usr/local/nginx/sbin/nginx -t 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
linux nginx启动、停止、重启命令
下载安装
#Install the prerequisites: sudo yum install yum-utils #install nginx sudo yum install nginx
启动
#使用默认的配置启动 sudo nginx #指定配置启动 /etc/nginx/nginx.conf 替换为自己的配置 sudo nginx -c /etc/nginx/nginx.conf #指定错误日志路径 /etc/nginx/error.log 替换为自己的配置 sudo nginx -e /etc/nginx/error.log
停止
#fast shutdown nginx -s stop #优雅的关闭 nginx -s quit #查询启动的nginx ps -ax | grep nginx # 强制kill nginx kill -9 pid # 优雅 kikk kill -s QUIT pid
重启
#1. 验证配置是否正确 nginx -t #2. 加载并应用新的配置 nginx -s reload
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持开源网www.osweb.cn。
猜你喜欢
- 2023-11-13 linux编译报错:/usr/include/c++/7/cstdlib:41:10: fatal error: bits/c++config.h: No such file or directory
- 2023-11-13 dpkg: error processing package installed xxx package post-removal script subprocess returned...
- 2023-11-13 linux shell的几种截取字符串的方法
- 2023-11-13 Linux sed命令关键字匹配文件中整行的任意字符然后替换整行
- 2023-11-13 Linux下执行的Shell脚本如何判断当前脚本执行是否有root权限
- 2023-11-13 linux的Shell脚本中如何判断某个命令是否存在
- 2023-11-13 Linux中date命令如何格式化输出需要的时间格式
- 2023-11-12 Nginx反向代理原理详解
- 2023-11-12 使用docker搭建Nginx + PHP + mysql环境
- 2023-11-12 linux中USB设备的绑定和解绑(类似于Windows中disable和enable)
你 发表评论:
欢迎- 开源分类
- 开源网标签
本文暂时没有评论,来添加一个吧(●'◡'●)