查看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
相关推荐
凌寒1129 分钟前
minio预签名访问地址经过Nginx代理后返回403问题
服务器·网络·nginx
广然39 分钟前
EVE-NG 镜像管理工具 1.1 Web 版本正式发布!
运维·服务器·前端
祁鱼鱼鱼鱼鱼44 分钟前
DNS 笔记记录
运维·服务器·网络
tod1131 小时前
Makefile进阶(上)
linux·运维·服务器·windows·makefile·进程
Data_Journal1 小时前
【无标题】
大数据·服务器·前端·数据库·人工智能
豆是浪个1 小时前
Linux(Centos 7.6)命令详解:top
linux·运维·服务器
矢志航天的阿洪2 小时前
从GitHub到本地:Python IGRF库环境配置完全指南
开发语言·python·github
_叶小格_2 小时前
cp、scp、rsync命令详解
linux·运维·服务器·ubuntu·centos·运维开发
凯子坚持 c3 小时前
Qt常用控件指南(7)
服务器·数据库·qt
mango_mangojuice3 小时前
Linux学习笔记 1.19
linux·服务器·数据库·笔记·学习