nginx linux 部署

该博客详细介绍了在Linux系统中如何部署Nginx服务器,包括源码安装和yum安装两种方法,以及后续的配置和测试流程,是Linux环境中Nginx部署的实用教程。
摘要由CSDN通过智能技术生成

 

1. 安装

1.1 源码安装

[root@localhost test]# wget http://nginx.org/download/nginx-1.22.1.tar.gz
[root@localhost test]# tar xvf nginx-1.22.1.tar.gz
[root@localhost test]# cd nginx-1.22.1


# 需要支持tcp数据转发,安装stream模块
[root@localhost nginx-1.22.1]# ./configure --without-http_rewrite_module --without-http_gzip_module --with-stream
[root@localhost nginx-1.22.1]# make -j

# 配置部署
[root@localhost nginx-1.22.1]# mkdir -p /usr/local/nginx
[root@localhost nginx-1.22.1]# mkdir -p /usr/local/nginx/logs
[root@localhost nginx-1.22.1]# cp -r conf /usr/local/nginx
[root@localhost nginx-1.22.1]# cp objs/nginx /usr/local/nginx/
[root@localhost nginx]# cd /usr/local/nginx/
[root@localhost nginx]# vim conf/nginx.conf

# 在events 配置后,添加stream 配置块
events {
    worker_connections  1024;
}

stream {
    server {
        listen 12345;
        proxy_pass 192.168.232.135:12345;
    }
}


[root@localhost nginx]# ./nginx

1.2 yum安装

su - root
yum install -y nginx
systemctl start nginx.service
systemctl enable nginx.service

2. 配置

3. 测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值