0

0

CentOS65下安装Nginx

php中文网

php中文网

发布时间:2016-07-29 09:15:18

|

1429人浏览过

|

来源于php中文网

原创


本次演示是在centos6.5/' target='_blank'>centos6.5操作系统下安装nginx

操作系统:CentOS6.5/' target='_blank'>CentOS6.5-x86-64

Nginx版本:nginx-release-centos-6-0.el6.ngx.noarch.rpm

Nginx下载地址:http://nginx.org/en/linux_packages.html#stable

Epel版本:epel-release-6-8.noarch.rpm

Epel包下载地址:http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Epel源镜像地址:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/

1、安装EPEL包

因安装nginx需要配置EPEL源,所以先安装EPEL的rpm包,到epel-release-6-8.noarch.rpm的目录下,安装EPEL:

[root@localhost tmp]# rpm -ivh epel-release-6-8.noarch.rpm

warning: epel-release-6-8.noarch.rpm: HeaderV3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...               ########################################### [100%]
  1:epel-release          ########################################### [100%]

2、配置EPEL源

因此次演示没有联网,所以nginx需要的EPEL源的文件需要自己下载,并进行源配置:

[root@localhost tmp]# vi  /etc/yum.repos.d/epel.repo

修改:(这里需要的EPEL源包放置 /tmp/epel目录下)

baseurl=file:///tmp/epel

注释:

#mirrorlist

InsCode
InsCode

InsCode 是CSDN旗下的一个无需安装的编程、协作和分享社区

下载

附:这是安装nginx需要的EPEL源的文件(/tmp/epel目录下)

(镜像地址:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/)

<strong>CentOS6</strong>5下安装Nginx

3、安装Nginx

1)安装Nginx的rpm包

[root@localhost tmp]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

warning:nginx-release-centos-6-0.el6.ngx.noarch.rpm: Header V4 RSA/SHA1 Signature, keyID 7bd9bf62: NOKEY
Preparing...               ########################################### [100%]
  1:nginx-release-centos  ########################################### [100%]

2)删除nginx源

[root@localhost yum.repos.d]# pwd

/etc/yum.repos.d


[root@localhost yum.repos.d]# rm nginx.repo

rm: remove regular file `nginx.repo'? y

3)安装Nginx

[root@localhost yum.repos.d]# yum install nginx

Loaded plugins: fastestmirror, security

Loading mirror speeds from cached hostfile

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package nginx.x86_640:1.0.15-12.el6 will be installed

--> Processing Dependency:nginx-filesystem = 1.0.15-12.el6 for package: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency:nginx-filesystem for package: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency: gd forpackage: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency: GeoIP forpackage: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency:libgd.so.2()(64bit) for package: nginx-1.0.15-12.el6.x86_64

--> Processing Dependency:libGeoIP.so.1()(64bit) for package: nginx-1.0.15-12.el6.x86_64

--> Running transaction check

---> Package GeoIP.x86_64 0:1.6.5-1.el6will be installed

--> Processing Dependency: geoipupdatefor package: GeoIP-1.6.5-1.el6.x86_64

--> Processing Dependency: GeoIP-datafor package: GeoIP-1.6.5-1.el6.x86_64

---> Package gd.x86_64 0:2.0.35-11.el6will be installed

--> Processing Dependency:libXpm.so.4()(64bit) for package: gd-2.0.35-11.el6.x86_64

---> Package nginx-filesystem.noarch0:1.0.15-12.el6 will be installed

--> Running transaction check

---> Package GeoIP-GeoLite-data.noarch0:2015.04-2.el6 will be installed

--> Processing Dependency:GeoIP-GeoLite-data-extra = 2015.04-2.el6 for package:GeoIP-GeoLite-data-2015.04-2.el6.noarch

---> Package geoipupdate.x86_640:2.2.1-2.el6 will be installed

---> Package libXpm.x86_640:3.5.10-2.el6 will be installed

--> Running transaction check

---> PackageGeoIP-GeoLite-data-extra.noarch 0:2015.04-2.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================================================

 Package                           Arch            Version                  Repository     Size

================================================================================================

Installing:

 nginx                             x86_64          1.0.15-12.el6            epel          404 k

Installing for dependencies:

 GeoIP                             x86_64          1.6.5-1.el6              epel          113 k

 GeoIP-GeoLite-data                noarch          2015.04-2.el6            epel          343 k

 GeoIP-GeoLite-data-extra          noarch          2015.04-2.el6            epel           23 M

 gd                                x86_64          2.0.35-11.el6            base          142 k

 geoipupdate                       x86_64          2.2.1-2.el6              epel           28 k

 libXpm                            x86_64          3.5.10-2.el6             base           51 k

 nginx-filesystem                  noarch          1.0.15-12.el6            epel          8.1 k

 

Transaction Summary

================================================================================================

Install       8 Package(s)

 

Total download size: 24 M

Installed size: 50 M

Is this ok [y/N]: y

Downloading Packages:

------------------------------------------------------------------------------------------------

Total                                                           61 MB/s |  24 MB     00:00    

warning: rpmts_HdrFromFdno: Header V3RSA/SHA256 Signature, key ID 0608b895: NOKEY

Retrieving key fromfile:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Importing GPG key 0x0608B895:

 Userid : EPEL (6)

 Package: epel-release-6-8.noarch (installed)

 From   :/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

 Installing : GeoIP-GeoLite-data-extra-2015.04-2.el6.noarch                                1/8

 Installing : GeoIP-GeoLite-data-2015.04-2.el6.noarch                                      2/8

 Installing : geoipupdate-2.2.1-2.el6.x86_64                                               3/8

 Installing : GeoIP-1.6.5-1.el6.x86_64                                                    4/8

 Installing : libXpm-3.5.10-2.el6.x86_64                                                  5/8

 Installing : gd-2.0.35-11.el6.x86_64                                                     6/8

 Installing : nginx-filesystem-1.0.15-12.el6.noarch                                        7/8

 Installing : nginx-1.0.15-12.el6.x86_64                                                  8/8

  Verifying : nginx-filesystem-1.0.15-12.el6.noarch                                        1/8

 Verifying  :GeoIP-1.6.5-1.el6.x86_64                                                    2/8

 Verifying  :GeoIP-GeoLite-data-2015.04-2.el6.noarch                                     3/8

 Verifying  :libXpm-3.5.10-2.el6.x86_64                                                  4/8

 Verifying  :geoipupdate-2.2.1-2.el6.x86_64                                              5/8

 Verifying  : GeoIP-GeoLite-data-extra-2015.04-2.el6.noarch                                6/8

 Verifying  :nginx-1.0.15-12.el6.x86_64                                                  7/8

 Verifying  :gd-2.0.35-11.el6.x86_64                                                     8/8

 

Installed:

 nginx.x86_64 0:1.0.15-12.el6                                                                 

 

Dependency Installed:

 GeoIP.x86_64 0:1.6.5-1.el6                       GeoIP-GeoLite-data.noarch 0:2015.04-2.el6 

 GeoIP-GeoLite-data-extra.noarch 0:2015.04-2.el6   gd.x86_64 0:2.0.35-11.el6                 

 geoipupdate.x86_64 0:2.2.1-2.el6                  libXpm.x86_640:3.5.10-2.el6              

 nginx-filesystem.noarch 0:1.0.15-12.el6         

 

Complete!

4)运行及检查nginx

[root@localhost yum.repos.d]# nginx

 
[root@localhost yum.repos.d]# whereis nginx

nginx: /usr/sbin/nginx /etc/nginx/usr/share/nginx /usr/share/man/man8/nginx.8.gz/usr/share/man/man3/nginx.3pm.gz

5)nginx版本

[root@localhost yum.repos.d]# /usr/sbin/nginx -v

nginx version: nginx/1.0.15

 

4、登录查看,成功

<strong>CentOS6</strong>5下安装Nginx

以上就介绍了CentOS65下安装Nginx,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

相关专题

更多
php源码安装教程大全
php源码安装教程大全

本专题整合了php源码安装教程,阅读专题下面的文章了解更多详细内容。

150

2025.12.31

php网站源码教程大全
php网站源码教程大全

本专题整合了php网站源码相关教程,阅读专题下面的文章了解更多详细内容。

88

2025.12.31

视频文件格式
视频文件格式

本专题整合了视频文件格式相关内容,阅读专题下面的文章了解更多详细内容。

90

2025.12.31

不受国内限制的浏览器大全
不受国内限制的浏览器大全

想找真正自由、无限制的上网体验?本合集精选2025年最开放、隐私强、访问无阻的浏览器App,涵盖Tor、Brave、Via、X浏览器、Mullvad等高自由度工具。支持自定义搜索引擎、广告拦截、隐身模式及全球网站无障碍访问,部分更具备防追踪、去谷歌化、双内核切换等高级功能。无论日常浏览、隐私保护还是突破地域限制,总有一款适合你!

61

2025.12.31

出现404解决方法大全
出现404解决方法大全

本专题整合了404错误解决方法大全,阅读专题下面的文章了解更多详细内容。

493

2025.12.31

html5怎么播放视频
html5怎么播放视频

想让网页流畅播放视频?本合集详解HTML5视频播放核心方法!涵盖<video>标签基础用法、多格式兼容(MP4/WebM/OGV)、自定义播放控件、响应式适配及常见浏览器兼容问题解决方案。无需插件,纯前端实现高清视频嵌入,助你快速打造现代化网页视频体验。

16

2025.12.31

关闭win10系统自动更新教程大全
关闭win10系统自动更新教程大全

本专题整合了关闭win10系统自动更新教程大全,阅读专题下面的文章了解更多详细内容。

12

2025.12.31

阻止电脑自动安装软件教程
阻止电脑自动安装软件教程

本专题整合了阻止电脑自动安装软件教程,阅读专题下面的文章了解更多详细教程。

5

2025.12.31

html5怎么使用
html5怎么使用

想快速上手HTML5开发?本合集为你整理最实用的HTML5使用指南!涵盖HTML5基础语法、主流框架(如Bootstrap、Vue、React)集成方法,以及无需安装、直接在线编辑运行的平台推荐(如CodePen、JSFiddle)。无论你是新手还是进阶开发者,都能轻松掌握HTML5网页制作、响应式布局与交互功能开发,零配置开启高效前端编程之旅!

2

2025.12.31

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
进程与SOCKET
进程与SOCKET

共6课时 | 0.3万人学习

nginx浅谈
nginx浅谈

共15课时 | 0.8万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号