查看nginx安装/配置路径
- 查看nginx的pid:
shell
ps -ef | grep 'nginx'

- 查看pid对应服务的启动路径
shell
ll /proc/2320/exe

- 使用检查配置文件命令,查看配置文件位置
shell
/usr/local/nginx/sbin/nginx -t

一个服务启动两个nginx
- 拷贝一份程序,
cpbin
是我自己创建的目录,可以按自己需求来:
shell
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/cpbin/nginx
- 拷贝一份配置文件,加上pid配置:
shell
# 拷贝配置文件
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginxcp.conf
# 编辑拷贝好的配置文件
vim nginx.conf

看对应的目录是否有该pid文件,没有则创建,有则打开并清空内容。
- 检查配置并启动
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
- 检查是否正常启动
shell
ps -ef|grep nginx
