查看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
相关推荐
疯狂成瘾者28 分钟前
服务器的单体和集群
运维·服务器
灵机一物2 小时前
灵机一物AI原生电商小程序、PC端(已上线)-GitHub 原生 gh-stack 上线:彻底告别大 PR 地狱,代码评审效率直接起飞
github
徐小夕5 小时前
100小时,我做了一款AI CAD建模软件,开源!
前端·vue.js·github
SWAGGY..5 小时前
Linux系统编程:(二)基础指令详解
linux·运维·服务器
阿福聊编程5 小时前
GitHub Trending 今日热榜 · 分类报告(2026-05-10)
github
蜡笔婧萱6 小时前
Linux--远程登录服务ssh
linux·服务器·ssh
雾岛心情6 小时前
小铭邮件管理工具箱的界面(公司版)
运维·服务器·工具·o365·小铭邮件工具箱(公司版)
伏加特遇上西柚6 小时前
Loki+Alloy+Grafana日志采集部署
java·linux·服务器·spring boot·grafana·prometheus
zl_dfq6 小时前
服务器设计细节 之 【eventfd、struct stat、stat接口】
服务器
资源分享助手6 小时前
三网H5小游戏战车向前冲搭建教程(Win+Linux)
linux·运维·服务器