依赖包安装

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. hread.interrupt()到底意味着什么

    首先,一个线程不应该由其他线程来强制中断或停止,而是应该由线程自己自行停止. 所以,Thread.stop, Thread.suspend, Thread.resume 都已经被废弃了.而 Threa ...

  2. Spring boot + mybatis + dubbo + zookeeper + mysql + mybatis-generator 一个小demo

    代码的链接地址:https://gitee.com/frostGG/springbooo_dubbo_demo.git 1.项目的目录经构: 介绍: 这一个项目,用的是阿里的dubbo,和zookee ...

  3. [转帖]Mysql各版本介绍及下载

    Mysql各版本介绍及下载 http://blog.itpub.net/12679300/viewspace-1251661/ 原创 MySQL 作者:wzq609 时间:2014-08-15 10: ...

  4. uniapp销毁addEventListener事件

    百度了很多vue的方法,结果都不适用,只好自己想办法,也是无关紧要的东西,不影响运行,但是看着心里都烦,有更好的解决方案欢迎指点上报错信息 这是一个监听滚动的方法,离开了那个页面进入详情页发现这个没有 ...

  5. AAct 一款 KMS 激活工具

    AAct是一款由俄罗斯网友Ratiborus制作的非常小巧实用的KMS激活工具,能自动设置密钥管理服务激活Windows.Office VL版本.支持手动安装及删除激活产品密钥.手动创建及删除续期计划 ...

  6. 总结:WPF中模板需要绑定父级别的ViewModel该如何处理

    原文:总结:WPF中模板需要绑定父级别的ViewModel该如何处理 <ListBox ItemsSource="{Binding ClassCollection}"> ...

  7. CentOS7 firewalld防火墙 启动 关闭 禁用 添加删除规则等 常用命令

    CentOS7 firewalld防火墙 常用命令1.firewalld的基本使用启动: systemctl start firewalld关闭: systemctl stop firewalld查看 ...

  8. Visual Studio 技巧

    Visual Studio 技巧 1 常用设置 2 常用快捷键 2.1 系统默认快捷键 2.2 自定义快捷键 3 修复系统错误 1 常用设置 Text Editor -> All Languag ...

  9. H5+asp.net 微信开发 遇到过的坑

    一.微信授权登录 1. 根据code 获取_access_tokens 2. 根据取到的openid和_access_tokens获取用户信息最神奇的是我用我自己的微信账号测试,一开始还可以取到tok ...

  10. winform datagridview控件使用

    最近做项目时,显示查询结果总需要绑定到datagridview控件上显示,总结了给datagridview绑定数据的方式,以及导出datagridview数据到excel表格,如有错误请多指教 1.直 ...