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 ...
随机推荐
- 【转帖】普通程序员如何转向AI方向
普通程序员如何转向AI方向 https://www.cnblogs.com/subconscious/p/6240151.html 眼下,人工智能已经成为越来越火的一个方向.普通程序员,如何转向人工智 ...
- 【Appium + Python + WebviewH5】之微信小程序自动化测试
进行调试,打开X5: http://debugmm.qq.com/?forcex5=true http://debugx5.qq.com http://debugtbs.qq.com 一般前两个就可以 ...
- Kafka Consumer Lag Monitoring
Sematext Monitoring 是最全面的Kafka监视解决方案之一,可捕获约200个Kafka指标,包括Kafka Broker,Producer和Consumer指标.尽管其中许多指标很 ...
- Apache信息头
package org.apache.http; public final class HttpHeaders { public static final String ACCEPT = " ...
- 60 网络编程(二)——URL
认识URI.URL.URN 详细请参考:https://blog.51cto.com/xoyabc/1905492 URI:uniform resource Indent 统一资源标识符 URL:un ...
- C语言注释风格
注释风格 一.前言 注释是源码程序中非常重要的一部分,一般情况下,源程序有效注释量必须在20%以上. 注释的原则是有助于对程序的阅读理解,所以注释语言必须准确.易懂.简洁,注释不宜太多也不能太少,注释 ...
- Docker在linux系统下的安装
系统要求 本安装教程仅限于CentOS7,其他系统不适用.centos-extras仓库必须是启用状态,这个仓库默认状态是启用,如果不是启用状态,请修改. 卸载旧版本的Docker Docker的旧版 ...
- 《PHP7底层设计与源码实现》学习笔记2——结构体对齐
书里给了一段代码,假如有个结构体如下: struct test { char a; int b; long c; void* d; int e; cha ...
- 整理:WPF中Binding的几种写法
原文:整理:WPF中Binding的几种写法 目的:整理WPF中Bind的写法 <!--绑定到DataContext--> <Button Content="{Bindin ...
- 如何将一个div盒子水平垂直都居中?
html代码如下: 固定样式: 方法一:利用定位(常用方法,推荐) .parent{ position:relative; } .child{ position:absolute; top:50%; ...