nginx-1.24.0 安装教程

1.下载nginx安装包

mkdir -p /home/app

cd /home/app

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

2. 解压缩

tar -zxf nginx-1.24.0.tar.gz

3.下载nginx二进制包编译所需的工具和依赖

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

4.编译安装

cd nginx-1.24.0

./configure --prefix=/home/app/nginx --with-http_stub_status_module --with-http_ssl_module

## --prefix 指定nginx的安装目录

## --with-http_stub_status_module 启用ngx_http_stub_status_module 支持查看nginx的状态页。

## --with-http_ssl_module 启用https支持

## 其他参数视情况设置,具体可以通过./configure --help 来查看参数详情

5、编译安装nginx

make && make install

6、启动nginx

6.1 进入nginx安装目录

cd /home/app/nginx/sbin

6.2 启动

./nginx

6.3 开启80端口

# 启动防火墙

systemctl start firewalld.service

# 开放80端口

firewall-cmd --zone=public --add-port=80/tcp --permanent

#关闭80端口

firewall-cmd --zone=public --remove-port=80/tcp --permanent

# 配置立即生效

firewall-cmd --reload

# 重启防火墙

service firewalld restart

# 查看已开放的端口

firewall-cmd --list-ports

7、访问nginx

http://192.168.0.200/

8、停止服务

cd /home/app/nginx/sbin

./nginx -s stop

9、重启加载

cd /home/app/nginx/sbin

./nginx -s reload

  • 16
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值