Nginx 测试环境配置,留做笔记

以下全是配置文件的配置,如果有疑问还请移步Nginx官网参考官方文档。

环境:

[root@CentOS6-M01 conf]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@CentOS6-M01 conf]# uname -r
2.6.-696.18..el6.x86_64 [root@CentOS6-M01 conf]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-stream --with-stream_ssl_module

一、nginx.conf 配置

user nginx;
pid /usr/local/nginx/logs/nginx.pid;
worker_processes auto;
events {
use epoll;
worker_connections ;
multi_accept on;
} http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on; keepalive_timeout ; client_header_timeout ;
client_body_timeout ; reset_timedout_connection on;
send_timeout ; limit_conn_zone $binary_remote_addr zone=addr:5m;
limit_conn addr ; include mime.types;
default_type application/octet-stream;
charset utf-; gzip on;
gzip_http_version 1.0;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml
application/xml+rss text/javascript;
gzip_min_length ;
gzip_comp_level ;
gzip_vary on; open_file_cache max= inactive=20s;
open_file_cache_min_uses ;
open_file_cache_valid 30s;
open_file_cache_errors on; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log /usr/local/nginx/logs/access.log main;
access_log off;
error_log /usr/local/nginx/logs/error.log crit; include /usr/local/nginx/conf/http_hosts/*.conf;
} include /usr/local/nginx/conf/tcp_hosts/*.conf;

二、http_hosts/test.conf 配置

    upstream tomcat_test {
#ip_hash; #固定session
server 127.0.0.1:;
} server {
listen ;
server_name localhost;
location / {
root html;
index index.html index.htm;
} location /tomcat {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://tomcat_test;
proxy_redirect default;
client_max_body_size 50m;
} location /download {
charset utf-;
root /data/;
#alias /data/download/; if ($request_filename ~* ^.*?\.(txt)$){
add_header Content-Disposition 'attachment';
add_header Content-Type: 'APPLICATION/OCTET-STREAM';} autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
access_log /usr/local/nginx/logs/download.log main;
} error_page /50x.html;
location = /50x.html {
root html;
} access_log /usr/local/nginx/logs/port--access.log main;
}

三、 tcp_hosts/test.conf 配置

stream {
upstream tcp_template {
server 127.0.0.1:;
} server {
listen ssl;
proxy_pass tcp_template;
#指定key 和 crt 地址
#ssl_certificate certs/my.crt;
#ssl_certificate_key certs/my.key;
ssl_protocols SSLv3 TLSv1 TLSv1. TLSv1.;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 4h;
ssl_handshake_timeout 30s;
}
server {
listen ;
proxy_pass tcp_template;
} }

Nginx 测试环境配置,留作笔记使用的更多相关文章

  1. wordpress nginx详细环境配置安装命令和相关问题解决

    很详细的有关WordPress和nginx的环境配置安装操作步骤 指南,适合新手一步步按照命令操作安装WordPress并运行在生产环境中. 操作步骤转载自: Heap Stack blog(ping ...

  2. Jmeter接口测试+压力测试+环境配置+证书导出

    jmeter是apache公司基于java开发的一款开源压力测试工具,体积小,功能全,使用方便,是一个比较轻量级的测试工具,使用起来非常简单.因为jmeter是java开发的,所以运行的时候必须先要安 ...

  3. Jest+Enzyme React js/typescript测试环境配置案例

    本文案例github:https://github.com/axel10/react-jest-typescript-demo 配置jest的react测试环境时我们可以参考官方的配置教程: http ...

  4. Android测试环境配置

    测试是软件开发中非常重要的一部分,Android中是使用junit测试框架,本文使用的是junit4和Android Studio.Android测试主要分两类本地测试和Instrumented测试, ...

  5. Windows10+eclipse+hadoop2.7.1环境配置+wordcount-折腾笔记

    刚用Ambari搭建好Hadoop,就开始写Hello World! 一.背景 1.Hadoop版本 经查看为2.7.1           Shell   1 2 3 4 5 6 7 [root@T ...

  6. WindowsOS下Nginx+PHP环境配置

    Nginx 配置虚拟主机 在conf目录中的nginx.conf中最后一行前面加上 include vhost/*.conf; 在conf目录中添加一个文件夹vhost(此文件夹用来保存Nginx虚拟 ...

  7. Yii1.1测试环境配置(一)

    一.安装wampserver wampserver集成了PHP.Apacha.MySql,可以省去分别安装的麻烦.wampserver的安装配置方法可以自行搜索. wampserver安装完成后需要手 ...

  8. Nginx之https配置 - 运维笔记 (http->https强转)

    一.Nginx安装(略)安装的时候需要注意加上 --with-http_ssl_module,因为http_ssl_module不属于Nginx的基本模块.Nginx安装方法: # ./configu ...

  9. 沙箱测试环境配置AND证书添加

    支付宝SDK接口项目Demo测试 一.进入支付宝开放中心 下载密钥生成器 https://developers.alipay.com/developmentAccess/developmentAcce ...

随机推荐

  1. CNPM

    cnpm 代替 npm npm install -g cnpm --registry=https://registry.npm.taobao.org Reference 淘宝 NPM 镜像

  2. HDU 6362(求椭圆中矩形周长的期望 数学)

    题意是给定一个椭圆标准方程的a,b(椭圆的长半轴长和短半轴长),在[0,b]内取一个数,则过点(0,b)且平行于x轴的直线与椭圆交于两点,再将此两点关于x轴做对称点,顺次连接此四点构成矩形,求出这些矩 ...

  3. MVC实用架构设计(三)——EF-Code First(1):Repository,UnitOfWork,DbContext

    前言 终于到EF了,实在不好意思,最近有点忙,本篇离上一篇发布已经一个多星期了,工作中的小迭代告一段落,终于有点时间来继续我们的架构设计了,在这里先对大家表示歉意. 其实这段时间我并不是把这个系列给忘 ...

  4. zookeeper的Java端API应用

    1. 基本使用 org.apache.zookeeper.Zookeeper是客户端入口主类,负责建立与server的会话.它提供了表1所示几类主要方法: 功能 描述 create 在本地目录树中创建 ...

  5. qlikview 权限管理和sso集成

    简单总结一下 qlikview 权限管理和SSO集成的过程, 在集成qlikview报表过程中碰到了很多坑, 甚至官方文档也不准确.  如果你也有类似的需求, 可以参考一下本文.  需要说明的是, 本 ...

  6. vue 用checkbox 做多选,带选中样式

    <dl v-for="(item,index) in listData" :key="index"> testName <label> ...

  7. 32. Springboot 系列(八)动态Banner与图片转字符图案的手动实现

    使用过 Springboot 的对上面这个图案肯定不会陌生,Springboot 启动的同时会打印上面的图案,并带有版本号.查看官方文档可以找到关于 banner 的描述 The banner tha ...

  8. luogu 1772 物流运输 ZJOI2006 spfa+dp

    主要路径上存在时间限制(消失) 因为数据较小(点数较小),利用限制条件在规定时间内分别spfa,(也可用floyd) 再通过dp取最优值 #include<bits/stdc++.h> # ...

  9. js call使用

    call 方法 请参阅 应用于:Function 对象 要求 版本 5.5 调用一个对象的一个方法,以另一个对象替换当前对象. call([thisObj[,arg1[, arg2[, [,.argN ...

  10. 函数语法:Js之on和addEventListener的使用与不同

    一.addEventListener语法 DOM标准:elem.addEventListener("事件名",函数对象,是否在捕获阶段触发) ---是否在捕获阶段触发= true/ ...