Linux下nginx安装

centos直接yum安装nginx

Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便。

1.rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

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  
时间: 2024-09-11 12:44:04

Linux下nginx安装的相关文章

Linux 下Nginx 安装

安装nginx前,我们首先要确保系统安装了g++.gcc.openssl-devel.pcre-devel和zlib-devel软件  #插件安装 yum install gcc-c++ yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel #解压安装 tar -zxvf nginx 进入目录 ./configure --prefix=/usr/local/server/nginx make  make inst

Linux下 nginx + 最新版php5.5 安装配置详解

1.nginx的安装: 首先nginx的安装需要依赖最基础的三个包,这里面我们不设计更多的扩展模块,只是安装最基础的三个包, zlib 此包主要是对http内容进行gzip压缩,减少网络传输流量 PCRE 此包主要是让nginx支持正则表达式,这个是必须装的,就连nginx的conf文件中都有正则表达式 openssl 此包主要是nginx支持https的请求 首先下载下来nginx的安装包:nginx-1.4.2.tar.gz 然后执行命令:tar -xzvf nginx-1.4.2.tar.

Linux下nginx日志每天定时切割实例

教程目的:   使用Linux系统自带的命令logrotate对Nginx日志进行切割.   Nginx安装目录:/usr/local/nginx/   Nginx日志目录:/usr/local/nginx/logs/./usr/local/nginx/logs/nginx_logs/  1.添加nginx日志切割脚本   cd  /etc/logrotate.d  #进入目录   vi   /etc/logrotate.d/nginx   #编辑脚本   /usr/local/nginx/lo

Linux下PHP安装curl扩展支持https例子

问题:   线上运行的lamp服务器,默认yum安装的curl模块只支持http,不支持https.   解决方法:   编译安装curl,重新编译php,使php的curl模块支持https.   具体步骤:   1.下载curl   cd /usr/local/src  #进入安装包存放目录   wget http://curl.haxx.se/download/curl-7.44.0.tar.gz  #下载   2.安装curl   cd /usr/local/src   tar zxvf

Linux下php安装Redis扩展的方法_服务器其它

本文实例讲述了Linux下php安装Redis扩展的方法.分享给大家供大家参考,具体如下: 注意:目录的权限   chomd 777 -R 1.安装redis 下载:https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz 上传phpredis-2.2.4.tar.gz到/usr/local/src目录 cd /usr/local/src #进入软件包存放目录 tar zxvf phpredis-2.2.4.tar.gz #解压 cd

Linux下php安装imagick教程详解

说明: php安装目录:/usr/local/php5 php.ini配置文件路径:/usr/local/php5/etc/php.ini Nginx安装目录:/usr/local/nginx Nginx网站根目录:/usr/local/nginx/html 1.安装编译工具 yum install wget make gcc gcc-c++ gtk+-devel zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch

Linux下nginx配置https协议访问的方法_Linux

一.配置nginx支持https协议访问,需要在编译安装nginx的时候添加相应的模块--with-http_ssl_module 查看nginx编译参数:/usr/local/nginx/sbin/nginx -V 如下所示: configure arguments: --prefix=/usr/local/nginx --with-google_perftools_module --without-http_memcached_module --user=www --group=www --

Oracle8i在linux下的安装(中文)

oracle|中文 Oracle8i在linux下的安装(中文)  转摘自flyfox的站点  发布时间:2001年01月04日  详细信息:准备工作--安装Oracle服务器 我认为Microsoft Windows是个不错的操作系统,它在市场方面获得了空前的成功,并造就了盖茨.巴尔默等百亿富翁.它简单易用,得到了广泛地普及,几乎每个计算机爱好者都会操作Windows,几乎每个程序员都会Windows编程.目前为了占领市场,排挤Linux,Windows2000在PC的预装费用从以前Windo

Linux下软件安装详解

在Windows下安装软件时,只需用鼠标双击软件的安装程序,或者用Zip等解压缩软件解压缩即可安装.在Linux下安装软件对初学者来说,难度高于Windows下软件安装.下面我就详细讲解Linux下如何安装软件. 先来看看Linux软件扩展名.软件后缀为.rpm最初是Red Hat Linux提供的一种包封装格式,现在许多Linux发行版本都使用:后缀为.deb是Debain Linux提供的一种包封装格式:后缀为.tar.gz.tar.Z.tar.bz2或.tgz是使用Unix系统打包工具ta