查看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
相关推荐
杨云龙UP16 分钟前
SQL Server2022部署:Windows Server 2016下安装、SSMS配置、备份还原与1433端口放通全流程_20260508
运维·服务器·数据库·sql·sqlserver·2022
武超杰1 小时前
Nginx从入门到精通
运维·nginx
weixin_704266051 小时前
Nginx 反向代理 + 6 种负载均衡策略
运维·nginx
fish_xk2 小时前
Linux开方工具
linux·运维·服务器
m0_738120723 小时前
应急响应(重点)——记一次某公司流量应急溯源分析(附带下载链接)
服务器·前端·数据库·安全·web安全·网络安全
Rkgua4 小时前
初学者对与.gitignore应该有的了解
github
techdashen4 小时前
Pingora 的开源——Cloudflare 基于 Rust 搭建的用于替换Nginx的网络框架
nginx·rust·开源
中科三方4 小时前
输入域名后无法访问?教你快速区分域名解析问题与服务器问题
运维·服务器
liuluyang5305 小时前
linux kernel CONFIG_KCMP解析
linux·运维·服务器
darkb1rd5 小时前
deepclaude:低成本指南,17 倍省调用费
开源·github·好物分享