依赖包安装

yum -y install gcc gcc-c++ make automake autoconf pcre pcre-devel zlib zlib-devel openssl openssl-devel libtool

编译安装

cd /usr/share/dev/
wget http://mirrors.sohu.com/nginx/nginx-1.16.1.tar.gz
./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-stream
或者./configure --prefix=/data/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream
make&&make install

nginx启动以及关闭

cd /sbin
./nginx
./nginx -s stop/reload

测试配置文件

nginx -t

修改nginx.conf,配置tcp转发

cd /etc/nginx
vim nginx.conf
stream {
upstream tcp {
server 10.66.34.20:3389;
hash $remote_addr consistent;
}
server {
listen 33890;
proxy_connect_timeout 10s;
proxy_timeout 60s;
proxy_pass tcp;
}
}

配置UDP转发,位于stream下方

stream {
upstream tcp {
server 10.66.34.20:3389;
hash $remote_addr consistent;
}
server {
listen 33890 udp reuseport;
proxy_connect_timeout 10s;
proxy_timeout 60s;
proxy_pass tcp;
}
}

设置nginx开机启动

vim /etc/rc.local
增加一行 /usr/sbin/nginx
chmod 755 rc.local

nginx编译安装以及配置tcp转发的更多相关文章

  1. LNMP平台搭建之一:nginx编译安装

    参考博客:https://www.cnblogs.com/zhang-shijie/p/5294162.html   jack.zhang 一.环境说明 系统环境:centos6.5 [root@lo ...

  2. Nginx编译安装lua-nginx-module

    lua-nginx-module 模块可以将Lua的强大功能嵌入NGINX服务器. 下载Nginx源码 如果已安装Nginx,需要查看当前安装版本的编译参数: $ /usr/local/nginx/s ...

  3. Linux下nginx编译安装教程和编译参数详解

    这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...

  4. CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境

    CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境 什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/ ...

  5. nginx的安装与配置

    1.nginx的安装与配置 编译安装nginx需要实现安装开发包组“Development tools”和“Server Platform Development”.“Desktop Platform ...

  6. [nginx]编译安装及安全优化

    nginx配置-最后整理版 nginx_upstream_check_module nginx-module-vts nginx打补丁 nginx编译安装 - 下载 cd /usr/local/src ...

  7. Nginx编译安装第三方模块http_substitutions_filter_module2222

    Nginx编译安装第三方模块http_substitutions_filter_module Rming -- 阅读 安装 Http 编译 module filter nginx 模块 >> ...

  8. Nginx编译安装第三方模块http_substitutions_filter_module

    Nginx编译安装第三方模块http_substitutions_filter_module 分类:服务器技术  作者:rming  时间:-- . >>ngx_http_substitu ...

  9. php编译安装与配置

    php编译安装与配置 =========================================== 官网:http://php.net/ 官网下载:http://php.net/downlo ...

随机推荐

  1. windows下Apache2.4配置php的解析运行

    1.安装php7 2.安装apache2.4 3.找到apache2.4的httpd.conf文件,配置好apache,然后通过httpd.exe -k install -n "servic ...

  2. 爬虫(一)基础知识(python)

    1.1 定义 网络爬虫,也叫网络蜘蛛(Web Spider),如果把互联网比喻成一个蜘蛛网,Spider就是一只在网上爬来爬去的蜘蛛.网络爬虫就是根据网页的地址来寻找网页的,也就是URL.举一个简单的 ...

  3. Excel VBA业余爱好者心得及总结

    我不是IT专业人士,而是一位医务工作者,当初学习Excel VBA时,是因为读研究生时的课题需要:实验仪器每天产生4个Word文件,每个文件有9个表格,总计近百个数据.为了对这些数据进行统计分析,则需 ...

  4. 【转】JavaScript 高性能数组去重

    原文地址:https://www.cnblogs.com/wisewrong/p/9642264.html 一.测试模版 数组去重是一个老生常谈的问题,网上流传着有各种各样的解法 为了测试这些解法的性 ...

  5. SQL系列(二)—— 查询(select)

    在开始之前先了解下SQL中的操作分类.根据与数据库不同操作的交互,对数据不同的处理类型,可以将SQL分为四种:插入.删除.修改.查询.本篇文章中主要介绍查询操作.其实查询操作也是日常应用使用最为频繁且 ...

  6. 近3年常考的Spring面试题及答案

    1. 一般问题 1.1. 不同版本的 Spring Framework 有哪些主要功能? Version Feature Spring 2.5 发布于 2007 年.这是第一个支持注解的版本. Spr ...

  7. 通过静态发现方式部署 Etcd 集群

    在「etcd使用入门」一文中对etcd的基本知识点和安装做了一个简要的介绍,这次我们来说说如何部署一个etcd集群. etcd构建自身高可用集群主要有三种形式: 静态发现: 预先已知etcd集群中有哪 ...

  8. 【java】单实例下的 流水号【21位】

    单实例环境,不是分布式 需要流水号 /** * 流水号生成器 * * 年+天号+毫秒+随机数 * 2019+134+480+11位随机数 * 4+3+3+11 = 21位 * * * @author ...

  9. C# System.Reflection.Assembly动态加载资源文件

    需求:需要做甘特图的显示,并且在甘特中加载图片.图片太多,写判断代码太多.用反射吧. 核心代码: try { if (stateColour < 0) return null; System.R ...

  10. 封装:WPF中可以绑定的BindPassWord控件

    原文:封装:WPF中可以绑定的BindPassWord控件 一.目的:本身自带的PassWord不支持绑定 二.Xaml部分 <UserControl x:Class="HeBianG ...