查看nginx安装/配置路径,一个服务器启动两个nginx

查看nginx安装/配置路径

  1. 查看nginx的pid:
shell 复制代码
ps -ef | grep 'nginx'
  1. 查看pid对应服务的启动路径
shell 复制代码
ll /proc/2320/exe
  1. 使用检查配置文件命令,查看配置文件位置
shell 复制代码
/usr/local/nginx/sbin/nginx -t

一个服务启动两个nginx

  1. 拷贝一份程序,cpbin是我自己创建的目录,可以按自己需求来:
shell 复制代码
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/cpbin/nginx
  1. 拷贝一份配置文件,加上pid配置:
shell 复制代码
# 拷贝配置文件
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginxcp.conf
# 编辑拷贝好的配置文件
vim nginx.conf

看对应的目录是否有该pid文件,没有则创建,有则打开并清空内容。

  1. 检查配置并启动
shell 复制代码
# 检查配置文件
/usr/local/nginx/cpbin/nginx -c /usr/local/nginx/conf/nginxcp.conf -t
# 启动
/usr/local/nginx/cpbin/nginx -c /usr/local/nginx/conf/nginxcp.conf
  1. 检查是否正常启动
shell 复制代码
ps -ef|grep nginx
相关推荐
梁bk2 小时前
[Nginx]反向代理和负载均衡
运维·nginx·负载均衡
Leinwin6 小时前
微软开源GitHub Copilot Chat,AI编程领域迎新突破
microsoft·github·copilot
(:满天星:)8 小时前
第31篇:块设备与字符设备管理深度解析(基于OpenEuler 24.03)
linux·运维·服务器·网络·centos
小陶来咯8 小时前
【仿muduo库实现并发服务器】Acceptor模块
运维·服务器
爱莉希雅&&&8 小时前
shell编程之awk命令详解
linux·服务器·git
笑稀了的野生俊8 小时前
在服务器中下载 HuggingFace 模型:终极指南
linux·服务器·python·bash·gpu算力
小扎仙森9 小时前
关于服务器宝塔转移wordperss子比主题问题
运维·服务器
小小小糖果人9 小时前
Linux云计算基础篇(5)
linux·运维·服务器
草梅友仁9 小时前
草梅 Auth 与 AI 开发心得 | 2025 年第 27 周草梅周报
github·ai编程·视觉设计
绝不偷吃10 小时前
FastDFS分布式储存
linux·nginx