查看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
相关推荐
Snasph13 小时前
GNU Make 用户手册(中文版)
服务器·算法·gnu
广州灵眸科技有限公司13 小时前
瑞芯微RV1126B开发板(EASY-EAI-PI2) Easy-Eai编译环境准备与更新
服务器·前端·人工智能·python·深度学习
Esaka_Forever14 小时前
uv init 完整用法(Python 最快包管理器)
服务器·python·uv
溜达的大象14 小时前
服务器挂了等用户报障?我用Prometheus搭了一套监控告警,服务器出状况第一时间通知我
服务器·php·prometheus
闪电悠米16 小时前
黑马点评-Redisson-01_why_redisson
java·服务器·网络·数据库·缓存·wpf
tudoSearcher17 小时前
日志、指标、链路追踪:可观测性三支柱深度解析
运维·服务器·网络·prometheus
xier_ran17 小时前
【infra之路】Linux基础命令与系统排查
linux·运维·服务器
c2385618 小时前
linux基础2
linux·运维·服务器
Soari18 小时前
GitHub 开源项目解析:rk‑llama.cpp —— 基于 llama.cpp 的 Rockchip NPU 加速本地推理引擎
开源·github·llama·llm 推理·npu 本地模型推理·加速 c/c++ 开源项目
Hommy8818 小时前
【开源剪映小助手】核心功能特性
开源·github·视频剪辑自动化·剪映api