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 ...
随机推荐
- VUE:页面跳转时传递参数,及参数获取
https://www.cnblogs.com/zhongchao666/p/9679807.html https://blog.csdn.net/mf_717714/article/details/ ...
- 根据jdk1.8源码整理而得,java集合体系(继承、实现关系)图解,超清晰,一看就懂,方便记忆
一.前言 1. 该关系图是本人根据JDK1.8 源码整理所得,只整理了常用的.常见的集合,并非全部. 2. 整理逻辑: Collection接口下有两个子接口:List 和 Set 接口. Map是独 ...
- python抓取每期双色球中奖号码,用于分析
获取每期双色球中奖号码,便于观察,话不多说,代码如下 # -*- coding:utf-8 -*- # __author__ :kusy # __content__:获取每期双色球中奖号码 # __d ...
- C++完全二叉树的权值
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int ...
- linux - 用户配置文件
用户配文件: 1用户信息文件 /etc/passwd 2 影子文件 /etc/shadow 3 组信息文件 /etc/group 4 组密码文件 /etc/gshadow 1 用户信息文件 / ...
- win7系统 右击任务栏 资源管理器 弹出菜单“已固定”和“最近”项目不显示故障处理
故障描述:右击任务栏中资源管理器图标时,弹出菜单只有“资源管理器”和“解除锁定”两个项目,“已固定”和“最近”项目缺失不显示,其他程序均显示正常,只有资源管理器这样.此故障一般发生在经常使用“已固定” ...
- protoc文件生成cs文件
1.下载protoc工具 点击下载 2.下载解压后打开文件,其中有一个.bat文件,里面对应命令行如下: 编写如下命令行 protoc.exe -I=. --csharp_out=. --grpc_ ...
- Android 代码混淆、Android Proguard(混淆)
Android Proguard(混淆) 混淆(Proguard)用法 最近项目中遇到一些混淆相关的问题,由于之前对proguard了解不多,所以每次都是面向Stackoverflow的编程.co ...
- mybatis使用用stdout-logging日志显示sql语句
在开发中,我们很多时候需要知道当前执行的sql语句是什么样的,但是默认mybatis是不显示sql的,此时我们就可以使用stdout-logging了.1.创建mybatis-config.xml文件 ...
- dubbo循序渐进 - yml配置
Dubbo首先使用com.alibaba.dubbo.config.spring.schema.NamespaceHandler注册解析器,当spring解析xml配置文件时就会调用这些解析器生成对应 ...