centos8安装nginx

安装4个依赖

gcc zlib pcre openssl

yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

nginx或者

wget http://nginx.org/download/nginx-1.20.2.tar.gz
tar -zxvf nginx-1.20.2.tar.gz

cd nginx-1.20.2/
#编译并指定安装路径为 /usr/local/nginx
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_sub_module --with-http_gzip_static_module --with-pcre

还是当前路径 nginx-1.20.2/

注:!此目录为源码目录,非安装目录,安装到此目录会出错!!!

make&&make install

在这里插入图片描述
执行完会多出来一个nginx文件夹

cd /usr/local/nginx/sbin/

开启

./nginx

关闭

./nginx -s stop

重启

./nginx -s reload

输入ip,如果不能访问,则有可能是防火墙问题

#开放防火墙端口
firewall-cmd --permanent --zone=public --add-port=80/tcp

firewall-cmd --reload

或者关闭防火墙

systemctl stop firewalld

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值