Linux下nginx安装

Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便。
2.查看yum的nginx信息
yum info nginx

3,安装并启动nignx
[root@server ~]# yum install nginx
[root@server ~]# service nginx start
Starting nginx:                                            [  OK  ]

4,然后进入浏览器,输入http://192.168.0.161/测试,如果看到

service nginx reload
nginx -s reload

nginx -t -c /usr/nginx/conf/nginx.conf
或者
nginx -t (推荐)

/usr/nginx/sbin/nginx -t
==============================
[html] view plaincopy
 
  1. 自动安装选择最快的源  
  2. [root@localhost ~]# yum install yum-fastestmirror  
这里 我已经安装过,运行结果如下

 

 

[html] view plaincopy
 
  1. Loaded plugins: fastestmirror, refresh-packagekit, security  
  2. Loading mirror speeds from cached hostfile  
  3.  * base: ftp.riken.jp  
  4.  * epel: mirrors.zju.edu.cn  
  5.  * extras: ftp.riken.jp  
  6.  * updates: ftp.riken.jp  
  7. Setting up Install Process  
  8. Package yum-plugin-fastestmirror-1.1.30-30.el6.noarch already installed and latest version  

 

安装nginx

yum install nginx 

 

[html] view plaincopy
 
  1. [root@localhost ~]# yum install nginx  
  2. Loaded plugins: fastestmirror, refresh-packagekit, security  
  3. Loading mirror speeds from cached hostfile  
  4.  * base: ftp.riken.jp  
  5.  * epel: mirrors.opencas.cn  
  6.  * extras: ftp.riken.jp  
  7.  * updates: ftp.riken.jp  
  8. Setting up Install Process  
  9. Package nginx-1.8.0-1.el6.ngx.x86_64 already installed and latest version  

 

 

平滑升级

yum update nginx

执行命令前,首先配置nginx 源

[html] view plaincopy
 
  1. [root@localhost ~]# vim /etc/yum.repos.d/nginx.repo  

[html] view plaincopy
 
  1. #nginx.repo  
  2.   
  3. [nginx]  
  4. name=nginx repo  
  5. baseurl=http://nginx.org/packages/centos/6/$basearch/  
  6. gpgcheck=0  
  7. enabled=1  

执行: yum update nginx  

  1.   
  2. Complete!  
  3. [root@localhost ~]# service nginx stop  
  4. 停止 nginx:                                               [确定]  
  5. [root@localhost ~]# service nginx start  
  6. 正在启动 nginx:                                           [确定]  
  7. [root@localhost ~]# nginx -v  
  8. nginx version: nginx/1.8.0  
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值