zoukankan      html  css  js  c++  java
  • 查找nginx安装的路径以及相关安装操作命令

    1、查看nginx安装目录

    输入命令

    # ps  -ef | grep nginx

    返回结果包含安装目录

    root      2662     1  0 07:12 ?        00:00:00 nginx: master process /usr/sbin/nginx

    2、查看nginx.conf配置文件目录

    输入命令

    # nginx -t
    
    返回结果包含配置文件目录

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

    nginx: configuration file /etc/nginx/nginx.conf test is successful

    3、启动nginx服务

    [root@localhost ~]# nginx安装目录 -c nginx.conf配置文件目录

    参数 “-c” 指定了配置文件的路径,如果不加 “-c” 参数,Nginx 会默认加载其安装目录的 conf 子目录中的 nginx.conf 文件。

     

     

     


     

    查找nginx安装的路径以及相关安装操作命令

    Linux环境下,怎么确定Nginx是以那个config文件启动的? 
    [root@localhost ~]# ps -ef | grep nginx
    root 21196 1 0 23:40 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
    nginx 21197 21196 0 23:40 ? 00:00:00 nginx: worker process
    root 21199 20993 0 23:42 pts/0 00:00:00 grep --color=auto nginx
    ------------------------------------
    检查是否已经安装有nginx及对应目录:
    [root@localhost ~]# find /|grep nginx.conf
    /etc/nginx/conf.d
    /etc/nginx/conf.d/example_ssl.conf
    /etc/nginx/conf.d/default.conf
    /etc/nginx/nginx.conf
    ----------------------------------
    还可以用以下两个命令,找安装的路径
    [root@localhost ~]# netstat -tnlp|grep nginx
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 21196/nginx: master
    然后看到一行记录,复制最后的一个数据(进程ID)
    ps -aux |grep 进程ID
    就可以看到nginx的启动方式了。
    [root@localhost ~]# ps -aux |grep 21196
    root 21196 0.0 0.0 48044 924 ? Ss 23:40 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
    root 21204 0.0 0.2 112648 2320 pts/0 S+ 23:45 0:00 grep --color=auto 21196

    --------------------------------
    查看服务器上安装的nginx版本号,主要是通过ngix的-v或-V选项
    Linux下查看Nginx安装目录、版本号信息?
    -v 显示 nginx 的版本。
    -V 显示 nginx 的版本,编译器版本和配置参数。
    [root@localhost ~]# /usr/sbin/nginx -v
    nginx version: nginx/1.8.0

    ===================================
    查看linux系统版本命令
    [root@localhost ~]# cat /proc/version
    Linux version 4.1.5-x86_64-linode61 (maker@build) (gcc version 4.7.2 (Debian 4.7.2-5) ) #7 SMP Mon Aug 24 13:46:31 EDT 2015
    [root@localhost ~]# cat /etc/redhat-release
    CentOS Linux release 7.0.1406 (Core)

    ===================================
    Ubuntu下安装nginx,直接apt-get install nginx就行了

    CentOS 下安装nginx:
    centos7系统库中默认是没有nginx的rpm包的,所以我们自己需要先更新下rpm依赖库
    (1)使用yum安装nginx需要包括Nginx的库,安装Nginx的库
    rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    rpm包的安装:
    1.安装一个包
    # rpm -ivh
    2.升级一个包,没安装过的不能使用升级命令
    # rpm -Uvh
    3.移走一个包
    # rpm -e

    安装准备依赖lib库
    yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

    (2)使用下面命令安装nginx
    #yum install nginx

    (3)启动Nginx
    #service nginx start

    #systemctl start nginx.service
    (4)重启nginx
    service nginx restart


    原文链接:https://www.cnblogs.com/zdz8207/p/CentOS-nginx-yum.html

  • 相关阅读:
    使用 Spring data redis 结合 Spring cache 缓存数据配置
    Spring Web Flow 笔记
    Linux 定时实行一次任务命令
    css js 优化工具
    arch Failed to load module "intel"
    go 冒泡排序
    go (break goto continue)
    VirtualBox,Kernel driver not installed (rc=-1908)
    go运算符
    go iota
  • 原文地址:https://www.cnblogs.com/qianjilou/p/9550639.html
Copyright © 2011-2022 走看看