CentOS6.5使用yum命令方便快捷安装Nginx
2016-09-29 13:39
633 查看
当然,首先要求是可以联网的CentOS系统,因为yum安装需要互联网连接。
1.为了追加 nginx 的 yum 仓库,需要创建一个文件 /etc/yum.repos.d/nginx.repo,并将下面的内容复制进去:
2.编辑并保存/etc/yum.repos.d/nginx.repo文件后,在命令行下执行
会发现就是最新的稳定版
于是直接执行
安装即可
3.这种安装和从源代码编译Nginx的安装,文件所处的位置不一样,安装完执行下面的命令
你会发现主要文件安装到了/etc/nginx下
接下来是启动Nginx服务,可以执行
接着查看Nginx的进程
缺省是一个master,一个slave,可以在配置nginx.conf文件里调整
4.设置开机自动启动
在centos6.5下测试了一下,不用设置
chkconfig nginx on
可以自行开机自动启动
1.为了追加 nginx 的 yum 仓库,需要创建一个文件 /etc/yum.repos.d/nginx.repo,并将下面的内容复制进去:
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
2.编辑并保存/etc/yum.repos.d/nginx.repo文件后,在命令行下执行
[root@localhost ~]# yum list | grep nginx nginx.i386 1.4.7-1.el6.ngx @nginx nginx-debug.i386 1.4.7-1.el6.ngx nginx
会发现就是最新的稳定版
于是直接执行
yum -y install nginx
安装即可
3.这种安装和从源代码编译Nginx的安装,文件所处的位置不一样,安装完执行下面的命令
[root@localhost ~]# find / -name *nginx* /etc/nginx/nginx.conf [root@localhost ~]# whereis nginx nginx: /usr/sbin/nginx /etc/nginx /usr/share/nginx
你会发现主要文件安装到了/etc/nginx下
接下来是启动Nginx服务,可以执行
[root@localhost ~]# service nginx start 正在启动 nginx: [确定]
接着查看Nginx的进程
[root@localhost ~]# netstat -lntp | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7910/nginx [root@localhost ~]# ps -ef | grep nginx root 7910 1 0 23:43 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf nginx 7912 7910 0 23:43 ? 00:00:00 nginx: worker process root 7942 2459 0 23:52 pts/1 00:00:00 grep nginx
缺省是一个master,一个slave,可以在配置nginx.conf文件里调整
4.设置开机自动启动
在centos6.5下测试了一下,不用设置
chkconfig nginx on
可以自行开机自动启动
相关文章推荐
- CentOS6.5使用yum命令方便快捷安装Nginx
- CentOS6.5使用yum命令方便快捷安装Nginx
- CentOS6.5使用yum命令方便快捷安装Nginx
- CentOS6.5使用yum命令方便快捷安装Nginx
- CentOS6.5使用yum命令方便快捷安装Nginx与卸载
- CentOS6.5使用yum命令方便快捷安装Nginx
- CentOS6.5使用yum命令方便快捷安装Nginx
- centos6.5使用yum安装nginx+mysql+php
- CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org
- CentOS 6.5系统中使用yum安装MongoDB 2.6 教程
- CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org ***”
- CentOS 6.5系统使用yum方式安装LAMP环境和phpMyAdmin详细过程
- Centos6.5使用yum安装软件的时候 Another app is currently holding the yum lock; waiting for it to exit...
- CENTOS 6.5 配置YUM安装NGINX
- centos 6.4使用yum安装nginx + php + mysql
- Centos6.5使用yum安装mysql——快速上手必备
- Centos6.5使用yum安装mysql——快速上手必备
- CentOS 使用yum命令安装出现错误提示”could not retrieve mirrorlist http://mirrorlist.centos.org ***” - ybq155
- centos6.5直接yum安装nginx,并且支持php访问的配置
- CentOS 6.5 配置yum安装Nginx