美文网首页
查看nginx安装/配置路径,一个服务器启动两个nginx

查看nginx安装/配置路径,一个服务器启动两个nginx

作者: 王月亮17 | 来源:发表于2024-06-19 16:06 被阅读0次

    查看nginx安装/配置路径

    1. 查看nginx的pid:
    ps -ef | grep 'nginx'
    
    image.png
    1. 查看pid对应服务的启动路径
    ll /proc/2320/exe
    
    image.png
    1. 使用检查配置文件命令,查看配置文件位置
    /usr/local/nginx/sbin/nginx -t
    
    image.png

    一个服务启动两个nginx

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

    看对应的目录是否有该pid文件,没有则创建,有则打开并清空内容。

    1. 检查配置并启动
    # 检查配置文件
    /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. 检查是否正常启动
    ps -ef|grep nginx
    
    image.png

    相关文章

      网友评论

          本文标题:查看nginx安装/配置路径,一个服务器启动两个nginx

          本文链接:https://www.haomeiwen.com/subject/olgqcjtx.html