微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

查找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

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐