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

00044-centos 安装nginx

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

00044-centos 安装nginx

要安装nginx的依赖pcre
wget https://jaist.dl.sourceforge.net/project/pcre/pcre/8.44/pcre-8.44.tar.gz
tar -xvf pcre-8.44.tar.gz
cd pcre-8.44
#安装编译
./configure
这里出错:
configure: error: no acceptable C compiler found in $PATH
需要安装GCC软件套件
yum install gcc

安装后,再运行: ./configure
这里继续出错:
configure: error: Invalid C++ compiler or C++ compiler flags
安装:
yum install -y gcc-c++
安装后,再运行: ./configure
到这里,OK。

make && make install
#查看pcre版本
pcre-config --version

开始安装nginx:
wget https://nginx.org/download/nginx-1.20.0.tar.gz
tar -xvf nginx-1.20.0.tar.gz
cd nginx-1.20.0
#编译安装
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/pcre-8.44
这里出错:./configure: error: SSL modules require the OpenSSL library.
解决方法:执行以下命令:
yum -y install openssl openssl-devel
再执行上个安装命令,OK。

make && make install
#查看版本
/usr/local/nginx/sbin/nginx -v
安装完毕。

启动命令:
/usr/local/nginx/sbin/nginx (无参数) 启动
/usr/local/nginx/sbin/nginx -s stop (-s stop)关闭
/usr/local/nginx/sbin/nginx -s reload (-s reload)重启

浏览器输入ip:80, 即可访问。

查看防火墙:
systemctl status firewalld.service
systemctl stop firewalld.service(停止防火墙)
systemctl start firewalld.service(打开防火墙)

开放端口:

firewall-cmd --zone=public --add-port=10001/tcp --permanent 
firewall-cmd --zone=public --add-port=10002/tcp --permanent 
firewall-cmd --reload
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/725012.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

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

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