centos nginx 安装

本文详细介绍了在CentOS环境下使用yum安装Nginx、解压、配置、安装及启动的方法,包括解决可能遇到的配置权限问题、依赖库缺失等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.如果系统没安装 GCC 开发工具得先安装,可以用下面的命令

           yum -y groupinstall "Development Tools"


2.下载最新版本Nginx-1.6.0 网址http://nginx.org/en/download.html


3. 解压文件  

        tar zxvf nginx-1.6.0tar.gz


4. 拷贝到目录 /usr/local/下,并进入目录

        cp nginx-1.6.0 /usr/local/nginx-1.6.0

        cd nginx-1.6.0


5. 配置nginx

       ./configure --prefix=/usr/local/nginx 


可能出现下列错误:

提示没有./configure权限

      输入:chmod +x configure



错误提示 ./configure: error: the HTTP rewrite module requires the PCRE library.

     安装pcre-devel解决问题
     yum -y install pcre-devel

 

错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.   You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl=<path> options.

     解决办法  yum -y install openssl openssl-devel



6.安装

     make

     make install


centos下 文件移动和重命名命令:mv file1 file2



7.启动

确保系统的 80 端口没被其他程序占用,

/usr/local/nginx/sbin/nginx

 

检查是否启动成功:

netstat -ano|grep 80 有结果输入说明启动成功

 

 

打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。

 

8.重启

/usr/local/nginx/sbin/nginx –s reload
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值