栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

CentOS7安装Nginx

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

CentOS7安装Nginx

1、下载nginx下载地址

wget http://nginx.org/download/nginx-1.20.1.tar.gz

2、解压

tar -zvxf nginx-1.20.1.tar.gz 

3、预编译
进入解压后的目录 nginx-1.20.1进行预编译 ./configure --prefix=/opt/nginx 注意:–prefix是指定安装目录(建议指定)


出现错误 ./configure: error: C compiler cc is not found

解决方法:yum -y install gcc gcc-c++


出现错误 ./configure: error: the HTTP gzip module requires the zlib library.

解决方法: yum -y install zlib-devel


出现错误./configure: error: the HTTP rewrite module requires the PCRE library.

解决方法: yum -y install pcre-devel


这里表示已成功预编译

4、编译
make
出现错误:-bash: make: 未找到命令 (-bash: make: command not found)

解决方法: yum -y install make autoconf
5、安装

make install

安装结束后进入 /opt/nginx/sbin (前面指定安装目录地址/sbin)

然后启动 ./nginx 这条命令成功没有输出

查看启动状态 ps -ef |grep nginx

然后打开浏览器访问

如果出现访问不了,尝试关闭防火墙 systemctl stop firewalld.service 再访问。

永久关闭防火墙 systemctl disable firewalld.service

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/826913.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号