查看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
相关推荐
李大玄3 小时前
Google浏览器拓展工具 "GU"->google Utils
前端·javascript·github
每天吃饭的羊3 小时前
github上部署自己的静态项目
github
世事如云有卷舒4 小时前
Ubunt20.04搭建GitLab服务器,并借助cpolar实现公网访问
linux·服务器·gitlab
泰勒朗斯4 小时前
如何在新机器上设置github完成内容git push
git·github
qianmoQ4 小时前
GitHub 趋势日报 (2025年07月05日)
github
Little-Hu4 小时前
QML TextEdit组件
java·服务器·数据库
riverz12275 小时前
TCP backlog工作机制
服务器·网络·tcp/ip
2401_858286115 小时前
OS15.【Linux】gdb调试器的简单使用
linux·运维·服务器·开发语言·gdb
weixin_307779135 小时前
批量OCR的GitHub项目
python·github·ocr
c30%006 小时前
内网渗透——红日靶场五
运维·服务器