nginx编译安装以及配置tcp转发
依赖包安装
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转发的更多相关文章
- LNMP平台搭建之一:nginx编译安装
参考博客:https://www.cnblogs.com/zhang-shijie/p/5294162.html jack.zhang 一.环境说明 系统环境:centos6.5 [root@lo ...
- Nginx编译安装lua-nginx-module
lua-nginx-module 模块可以将Lua的强大功能嵌入NGINX服务器. 下载Nginx源码 如果已安装Nginx,需要查看当前安装版本的编译参数: $ /usr/local/nginx/s ...
- Linux下nginx编译安装教程和编译参数详解
这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...
- CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境
CentOS 7上源码编译安装和配置LNMP Web+phpMyAdmin服务器环境 什么是LNMP? LNMP(别名LEMP)是指由Linux, Nginx, MySQL/MariaDB, PHP/ ...
- nginx的安装与配置
1.nginx的安装与配置 编译安装nginx需要实现安装开发包组“Development tools”和“Server Platform Development”.“Desktop Platform ...
- [nginx]编译安装及安全优化
nginx配置-最后整理版 nginx_upstream_check_module nginx-module-vts nginx打补丁 nginx编译安装 - 下载 cd /usr/local/src ...
- Nginx编译安装第三方模块http_substitutions_filter_module2222
Nginx编译安装第三方模块http_substitutions_filter_module Rming -- 阅读 安装 Http 编译 module filter nginx 模块 >> ...
- Nginx编译安装第三方模块http_substitutions_filter_module
Nginx编译安装第三方模块http_substitutions_filter_module 分类:服务器技术 作者:rming 时间:-- . >>ngx_http_substitu ...
- php编译安装与配置
php编译安装与配置 =========================================== 官网:http://php.net/ 官网下载:http://php.net/downlo ...
随机推荐
- 【操作系统之七】Linux常用命令之tail
一.概念linux tail命令用途是按照要求将指定的文件的最后部分输出到标准设备,一般是终端,就是把某个档案文件的最后几行显示到终端上,如果该档案有更新,tail会自动刷新,确保你看到最新的档案内容 ...
- Python【每日一问】20
问: [基础题]: 企业发放的奖金根据利润提成.利润(I): 低于或等于10万元时,奖金可提10%: 高于10万元,低于20万元时,低于10万元的部分按10%提成,高于10万元的部分,可提成7.5%: ...
- SpringBoot+Mysql 无法保存emoj表情?
尤记得很久以前,想存 emoj 表情到 mysql 中,需要额外的将 emoj 表情转码之后保存,每次读取时,再解码还原成一下:每次这种 sb 的操作,真心感觉心塞,那么有没有办法直接存呢? mysq ...
- centos下导出docx为html
yum -y install libreoffice.x86_64 libreoffice --invisible --convert-to html --outdir /root/demo_html ...
- Rancher 构建 CI/CD 自动化流程 - 动态配置 Jenkins-slave(一)
一.说明 1)需求: Rancher 上部署 Jenkins-master,服务采用 Jenkins-slave 发布,发布完成后 Jenkins-slave 自动销毁. 2)环境: Rancher ...
- Win 10 设置右键以管理员方式打开 CMD 窗口
Add_Open_Command_Window_Here_as_Administrator.reg Windows Registry Editor Version 5.00 [-HKEY_CLASSE ...
- Java使用正则表达式匹配多行 Pattern flags
Java中正则匹配有多种模式,若不选择模式则默认为单行匹配 匹配模式(Pattern flags) compile()方法有两个模式 未开匹配模式 Pattern compile(String reg ...
- asp.net core 和consul
consul集群搭建 Consul是HashiCorp公司推出的使用go语言开发的开源工具,用于实现分布式系统的服务发现与配置,内置了服务注册与发现框架.分布一致性协议实现.健康检查.Key/Valu ...
- CSP-S2019 自闭记
$Day0:$ 最后一场zr十连测从200挂到60,嘴上说着攒rp心里觉得药丸. 得知自己在本校考试感觉8错. $Day1:$ 早上7点50到了校门口,没让进QAQ早知道我再下一把棋了. 于是跟熊聊天 ...
- <More Effective C#: 改善C#代码的50个有效方法>中文版翻译答疑
最近, 有一本很赞的.NET技术书中文版出版了 - <More Effective C#: 改善C#代码的50个有效方法>. 从广州\西安\长沙\上海等各地.NET俱乐部都收到反馈, ...